=============================================================================== === BUILDING =============================================================================== In order to compile and use tinyREST application, you need the following open source libraries: Apache Commons IO: http://commons.apache.org/proper/commons-io/download_io.cgi (referred to as lib/commons-io-1.1.jar in manifest class path) Apache Commons FileUpload: http://commons.apache.org/proper/commons-fileupload/download_fileupload.cgi (referred to as lib/commons-fileupload.jar in manifest class path) Apache Log4J: https://logging.apache.org/log4j/1.2/download.html (referred to as lib/log4j-1.2.14.jar in manifest class path) Javax-Servlet: http://www.java2s.com/Code/Jar/j/javax.servlet.htm (referred to as lib/javax.servlet.jar in manifest class path) =============================================================================== === RUNNING =============================================================================== To use the REST server without writing your own service class, simply create a configuration XML file and start the service using the latest jar file (tinyREST-1.0.15.jar or later). The jar will attempt to automatically detect a configuration file, but you can force it to use a specific configuration file like this: java -jar tinyREST-1.0.15.jar -cfg myConfig.xml The configuration file should have this format: Explanation: - Root element must be - Each REST service must be defined in a element. The important attributes are: context - Root context of service e.g. context="root" will require a URL like this: http://ip-address/root/... class - The name of the class which implements your REST service You can add more attributes - the parser will map them to parameter annotations in your constructor. In the example, the constructor takes a parameter called "message" like this: public Greeter2(@Param("message") @Default("Hallo") String message) {} Elements inside represent method calls in the service class. In the example, the REST service class contains a public method called "addQuestion". The definition typically looks like this: public void addMessage(@Param("question") String question, @Param("answer") @Default("test") String answer) {} The annotations used for constructors and methods in a class (as seen in the configuration above) is used from the package za.co.softco.reflect and is typically used for accessing constructors and methods using reflection. REST services can also be defined using annotations, but be sure to use annotations from the package za.co.softco.rest.model (for example @Parameter("question") for HTTP query parameters). The Greeter2 example uses annotations and is very easy to understand.