RESTful Web Service using Jersey

In this tutorial I am going to explain a very basic example using Jersey REST Services. Building webservices using the REST concept is popular because of its simple nature and light weight. We have already explained how to write REST services using the Spring MVC framework. Spring provides out of the box support for the REST integration using their MVC framework. Jersey is the reference implementation for the REST specification. Writing your first REST service is very simple.

1. SetUp Jersey Environment

You have to get the required JAR files to get start with Jersey development. You would require the following JAR files.

  • asm-all-3.3.1.jar
  • jersey-core-1.17.jar
  • jersey-server-1.17.jar
  • jersey-servlet-1.17.jar


Alternatively you can set the maven dependency if you use maven as the build tool.


2. Create Jersey REST Service

package org.jersey.examples;

public class JerseySimpleExample {
		public Response getMsg(@PathParam("param") String message) {
			String output = "HI Jersey : " + message;
			return Response.status(200).entity(output).build();

3. Configure Web.xml for Jersey Implementation

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
	xmlns="" xmlns:xsi=""
	<display-name>Jersey Example</display-name>

4. Run First Jersey Service

Onec the above steps are completed, you can access the Jersey application using the following URL:


I hope this tutorial helped you to easily get started on using the Jersey REST API. In my future articles, I will come up with few more examples.

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest

Share This

Share this post with your friends!