Signup/Sign In

Tools & Technologies used to develop REST Web Service

We will be focussing on developing and deplying REST web services in Java platform, and hence will be using the tools and technologies for the same. Basic concept of web service development is almost similar for each language with a few difference.

  1. JAX-RS - Set of annotations and interfaces provided by Java.
  2. Jersey - Implementation of the JAX-WS.
  3. Eclipse - Integrated Development Environment (Editor)
  4. Maven - Generating project structure and build tool.
  5. Apache Tomcat - Used for deploying the application.

What is JAX-RS and Jersey?

Let's discuss about both of them in detail.

JAX-RS

Java API for RESTful Web Services (JAX-RS) is a Java programming language specification that supports creating web services according to the REST architectural pattern in Java. JAX-RS uses annotations, included in Java SE-5, to simplify the deployment of web service clients and the end points.

It provides annotations to help in mapping a resource class (a POJO) as a web resource. These annotations include:

  • @Path specifies the relative path for a resource class or method.
  • @GET, @PUT, @POST, @DELETE specify the HTTP request methods.
  • @Produces specify the response type (internet media types), that a particular service will return.
  • @Consumes specify the accepted request (internet media types), that a particular service will accept.

In addition to these, it provides several other annotations, which are also quite useful when it comes to the development of web service.

It is important to note that JAX-RS is just a specification. It needs some implementation to work. JAX-RS can be seen as the interface, which contains all the specifications, more like a function which is exposed using a URI on Internet. But this function needs a definition/implementation, which contains the actual logic.

There are several implementation of the JAX-RS. Some famous one includes:

  1. Apache CXF, an open source Web Service Framework.
  2. Jersey, the reference implementation from SUN.
  3. Resteasy, this is JBoss implementation.
  4. Restlet

Jersey

Jersey is the reference implementation of the JAX-RS annotations. The Java API for RESTful Web Services, Jersey implements support for the annotation defined in the JSR-311, making it easy for the developers to build RESTful web services with Java and Java JVM. Jersey also specifies client libraries to help communicate with RESTful webservices.