Monday, 26 September 2016

Steps to Create a Simple RESTFUL Application using Jersey


Step 1:  Create a Maven Project in eclipse File --> new --> Others--> Maven Project
Note: Jersey is available as a bundle along with maven. So no need to download separate jars.

Step 2: Search for Jersey in the archetype filter, if it is not present click on Add Archetype and Enter the below details,

    <groupId>org.glassfish.jersey.archetypes</groupId>
    <artifactId>jersey-example-java8-webapp</artifactId>
    <version>2.23.2</version>

Leave the Repository URL Empty.

Step 3: Enter the project specific artifact id <org.rahul.awf> and group id<applicationName>

Step 4: Click on Finish

Step 5: Let Maven download all dependencies for the project

Step 6: Set up your web Server, for example Tomcat Server to eclipse
Step 7: Right Click your project and Run As --> Run On Server

Step 8. This is the URL where your application is hosted: http://localhost:8080/applicationName/ which displays the index.jsp page. You can make a rest call using the Jersey Resources link available in the index page.

Well Done!! Your First Restful Webapp is up and running!

-Rahul

No comments:

Post a Comment