Monday, August 9, 2010
RESTful Webservice with Jersey - Code example
This is a very basic RESTful Webservice done using Eclipse, Jersey Apache Tomcat. I used Eclipse 3.4.1, JDK 1.6 ,Tomcat V6 and Jersey 1.3 implements JAX-RS 1.1.
Steps:
1. In Eclipse create a "Dynamic Web Project" and project name is "MyFirstRESTFulWS".
2. Add the Jersey jars to class path.
3. Create a package "com.pu.test" and a java class "HelloJersey". This class is the resource which can be accessed by the URI.
4. HelloJersey java class
5. Change the web.xml
6.Deploy the Application in Tomcat and in the browser type the URI as follows:
http://localhost:8080/MyFirstRESTFulWS/rest/HelloWorld/John
And you will get the output as follows:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment