Search This Blog

Thursday, November 08, 2018

Jersey - reference implementation for JAX-RS (The Java API for RESTful Web Services)

Jersey is the JAX-RS (JSR 311 & JSR 339) Reference Implementation.

The Jersey implementation provides a library to implement Restful web services in a Java servlet container.

On the server side Jersey provides a servlet implementation which scans predefined classes to identify RESTful resources. In your web.xml configuration file your register this servlet for your web application.

This servlet analyzes the incoming HTTP request and selects the correct class and method to respond to this request. This selection is based on your configuration.

A REST web application consists data classes (resources) and services. These two types are typically maintained in different packages as the Jersey servlet will be instructed via the web.xml to scan certain packages for data classes.

JAX-RS supports the creation of XML and JSON via the Java Architecture for XML Binding (JAXB).

The Jersey implementation also provides a client library to communicate with a RESTful webservice.