Introduction to Jersey 2.x Restful web services

Jersey is the most popular amongst Restful web service development. Latest Jersey 2.x version has been developed by Oracle/Glassfish team in accordance with JAX-RS 2.0 specification. Earlier Jersey 1.x version was developed and supported by Oracle/Sun team

Detailed explanations about Restful web services see here

Jersey 2.x

Latest Jersey release version is 2.12 see here and look documentation and API for details

The Migration 2.0

Some key points to note down before start developing Jersey 2.x Restful web service

  • Earlier version 1.x was supported by Sun/Oracle team
  • Also servlet class in web.xml is “com.sun.jersey.servlet.servletcontainer
  • With Jersey 2.x release, above servlet class changed to “org.glassfish.jersey.servlet.ServletContainer
  • And it is supported by glassfish team under the umbrella of Oracle

JAX-RS Resource registration

The JAX-RS annotated classes’ needs to be registered in web.xml under <init-param> as

<!-- Register resources and providers -->
<init-param>
	<param-name>jersey.config.server.provider.packages</param-name>
	<param-value>qualified.package.name.of.jaxrs.class</param-value>
</init-param>

Read ON !!

Before you start working with latest Jersey release, read on some useful stuff to get started with high

Marek Potociar given good description about Jersey 2.x release which is in accordance with JAX-RS 2.0 read here

Jersey 2.x latest projects can be found in github.com

If you are working with maven integration, then you will find difference in the <groupId> & <artifactId> supplied in the maven co-ordinates

 
Jersey version
 
 
<groupId>
Jersey 1.x com.sun.jersey
Jersey 2.x org.glassfish.jersey

We will implement Jersey examples in the following articles based on latest 2.x version

Happy Coding !!
Happy Learning !!

Jersey 2.x web service using @PathParam annotation