A basic example of a REST-API using HTTP-Servlets.
Created with Eclipse IDE for Java EE Developers.
If you have a running Webserver like Tomcat
,
just put the web application archive (war)
in the according directory.
E.g. for Tomcat: tomcat-root/webapps/
.
Tomcat will automatically extract the archive and the servlet will be available at:
http://localhost:<port>/REST/
(Default port of Tomcat is 8080
)
The servlet is called people
so that the address to the collection is:
http://localhost:<port>/REST/people
Everything will be stored in the personen.xml
file located in:
REST/WEB-INF/classes/helpers/
You will also find the according XML-Schema file there.
- Open Eclipse JEE
- Import -> Existing Projects into Workspace
- Select the folder of this repository
- Finish
- Ensure you have Apache Tomcat installed
- Ensure you don't already have a Tomcat instance running on your machine.
- Download the Archive and extract it somewhere.
- In Eclipse - in the
Server
tab (rightclick) -> select New -> Server - Select your version and if not already done, configure your runtime environment to use the extracted archive
- Add the
REST-Example
Project to the Server - Select the server (rightclick) -> Publish
- Start the server