Providers of JAX-RS annotations


Some of the Implementation providers of JAX-RS annotations

JAX_RS-annotations_implementations

All the above providers provide the libraries to support the JSR 311 specifications.

We can use any one of these providers to develop the Restful web service.

Let’s see the overview of each of these implementations


Jersey Overview


Jersey is an open source framework which can be used to develop RESTful web services in Java.

Jersey provides a library which has the implementation for all the JAX-RS (JSR 311 and JSR 339) annotations

It supports both XML and JSON.

It provides both Client and server library for RESTful web services.


How it works?

jersey_service_flow

It provides a servlet implementation whose job is to identify the Restful resources among the java classes using JAX-RS annotations.

We just need to register this servlet in web.xml file of our web application.

Servlet class -> org.glassfish.jersey.servlet.ServletContainer

Jersey also provides client library to communicate with the Rest services.

Whenever the request comes in, jersey servlet defined in web.xml analyzes the request and locate the appropriate class and method to process the request.

This is possible by Jersey servlet because such classes and methods use the JAX-RS annotations which are implemented by Jersey.

For sample example implemented using Jersey, refer this article

RestEasy Overview


RestEasy is an open source framework which can be used to develop RESTful web services in Java.

It is provided as part of JBoss application server, so it comes with JBoss server by default.

It is portable and hence supports any other servlet container like Tomcat,Jetty etc.

RestEasy provides a library which has the implementation for all the JAX-RS annotations

It supports XML ,JSON,YAML etc.

It provides both Client and server library for RESTful web services.

How it works?

Resteasy_service_flow

It provides a servlet implementation whose job is to identify the Restful resources among the java classes using JAX-RS annotations.

We just need to register this servlet in web.xml file of our web application.

Servlet class -> org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher

RestEasy framework also provides client library to communicate with the Rest services.

Whenever the request comes in, RestEasy servlet defined in web.xml analyzes the request and locate the appropriate class and method to process the request.

This is possible by RestEasy servlet because such classes and methods use the JAX-RS annotations which are implemented by RestEasy.

For sample example implemented using RestEasy, refer this article

Restlet Overview


Restlet is a light weight open source framework which can be used to develop RESTful web services in Java.

Restlet provides a library which has the implementation for all the JAX-RS annotations.

It supports both XML and JSON.

It provides both Client and server library for RESTful web services.

It provides special editions for android,GWT etc.

How it works?

restlet_service_flow

It provides a servlet implementation whose job is to identify the Restful resources among the java classes using JAX-RS annotations and Application class.

We just need to register this servlet in web.xml file of our web application.

Servlet class -> org.restlet.ext.servlet.ServerServlet

Restlet framework also provides client library to communicate with the Rest services.

In Restlet, we can create a RESTful resource by extending Resource class.

We will define Application class to map the Resource with request URL.

we have to override createRoot() method or createInboundRoot() whichever is available in Application class.

Whenever the request comes in, Restlet servlet defined in web.xml analyzes the request and locate the appropriate Resource class to process the request.

For sample example implemented using Restlet, refer this article

Apache CXF Overview


CXF is an open source framework which can be used to develop RESTful web services in Java.

It can also be used to develop SOAP web services using JAX-WS API.

CXF provides a library which has the implementation for all the JAX-RS annotations.

It supports both XML and JSON formats.

It provides both Client and server library for RESTful web services.

How it works?

Apache-CXF_service_flow

It provides a servlet implementation whose job is to identify the Restful resources among the java classes using JAX-RS annotations.

We just need to register this servlet in web.xml file of our web application.

Servlet class -> org.apache.cxf.transport.servlet.CXFServlet

CXF also provides client library to communicate with the Rest services.

Whenever the request comes in, CXF servlet defined in web.xml analyzes the request and locate the appropriate class and method to process the request.

This is possible by CXF servlet because such classes and methods use the JAX-RS annotations which are implemented by CXF.

Note:

Apache CXF is mostly used for SAOP web services than Rest services.

About the Author

Founder of javainsimpleway.com
I love Java and open source technologies and very much passionate about software development.
I like to share my knowledge with others especially on technology 🙂
I have given all the examples as simple as possible to understand for the beginners.
All the code posted on my blog is developed,compiled and tested in my development environment.
If you find any mistakes or bugs, Please drop an email to kb.knowledge.sharing@gmail.com

Connect with me on Facebook for more updates

Share this article on