1. Teisės aktų programėlė
  2. Untitled project
  3. serveris

Overview

HTTPS SSH

On Ubuntu 12.04 you need to install Java 1.7:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update && sudo apt-get install oracle-jdk7-installer
sudo update-alternatives --display java

To install maven on Fedora 18:

sudo yum install maven

It should install everything you need. By default Fedora uses OpenJDK. If you want yo use Sun/Oracle Java then follow instructions in :

http://www.if-not-true-then-false.com/2010/install-sun-oracle-java-jdk-jre-7-on-fedora-centos-red-hat-rhel/

Install and setup your Postgresql database. In Fedora:

sudo yum install postgresql

Check out '/usr/share/doc/postgresql-9.2.4/README.rpm-dist' for Fedora specific configuration.

Set database specific properties:

cp src/main/resources/META-INF/persistence.xml.default src/main/resources/META-INF/persistence.xml
vim src/main/resources/META-INF/persistence.xml

Create database and import database schema:

createdb legalacts
psql legalacts < schema.sql

Run:

mvn package

Now you got two jars in 'target' directory: 'original-server-0.1-SNAPSHOT.jar' and 'server-0.1-SNAPSHOT.jar'. First has only your classes and second contains everything you need to run it (maybe except JRE(Java Runtime Environment), didn't check it out).

Run:

java -jar target/server-0.1-SNAPSHOT.jar

You have your server on 'http://localhost:8080/'.

Root directory lists acts metadata in JSON format.

/GET/10 - returns .xml with id=10.

See terminal from witch you executed server for error and debug info. To stop server press Ctrl+C or terminate process from task manager. To upload your files:

java -jar target/server-0.1-SNAPSHOT.jar --add paths/to/*.xml

If server is already running, do it on separate terminal.

To test server run this command:

curl -sXGET '127.0.0.1:8080?q=foo' | python -mjson.tool