This tutorial will explain on how to create your first REST based web project.
I will also let you know what things we need to take are of while creating the project and its importance.
Hope this link comes handy, in case of any issue feel free to leave a comment.
- Start eclipse and select appropriate workspace.
- Create your EAR project by selecting File->New->Enterprise Application Project. Click on "New Runtime" and select the version of JBOSS where you want to deploy this EAR.
- Once the EAR project is created, its time to create a Dynamic web Project. Select New->Dynamic Web Project
- This project name is part of the REST URL. So give it a name that you would like to see in your URL.
eg: http://localhost:8080/ProjectName/XXX - Check the option "Add Project to an EAR". Select the EAR project that you just created.
- javassist-3.8.0.GA.jar
- jaxrs-api-3.0.6.Final.jar
- resteasy-jaxrs-3.0.6.Final.jar
- scannotation-1.0.3.jar
- Now it is all setup, its time to create the sample RESTful Web Service. Right click on the Dynamic Web Project and select New->Other. Search for "Create a Sample RESTful Web Service" under Web Services and click Ok.
- The name of the Web Service is part of the REST URL. So give it a name that you would like to see in your URL.
eg: http://localhost:8080/demorestservice/webservice-name - Right click on the EAR project and select Run As->Run on Server and select the runtime server we created at start and click finish.
- You should be able to access the Hello World Sample RESTful Web Service using the following URL
Before you proceed further you would need to download the following RESTeasy jars and store them under demorestservice\WebContent\WEB-INF\lib.
http://localhost:8080/demorestservice/restservice
Hope this link comes handy, in case of any issue feel free to leave a comment.