Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jersey vs Jersey (Stand alone) vs Jersey with Grizzly vs Jersey with Tomcat - for REST services?

What is the difference between Jersey vs Jersey (Stand alone) vs Jersey with Grizzly vs Jersey with Tomcat - for REST services ?

Can I run Jersey without any additional need of a Server?

like image 990
Ap100 Avatar asked Mar 11 '15 05:03

Ap100


People also ask

What are Jersey servers for?

In a nutshell: you use jersey-server to expose REST APIs like in this example: @Path("/hello") class RESTDispatcher { @GET @Path("/world") public String helloWorld() { return "Hello world!" } }

What is Jersey servlet?

Jersey is a Java library for both serving and calling REST (or mainly HTTP, since not everything is REST) APIs. It's build on top of Java EE specifications, so it can be used on any server that implements these specifications, e.g. Tomcat. In your web. xml file you can define multiple servlets.


1 Answers

Jersey in itself is a framework for building RESTful web services. While it serves as reference implementation of the JAX-RS API, its can also be used in other modes

Standalone - plain Jersey API on top of Java (JDK 1.6 or above). Jersey provides an API for this

Jersey with Grizzly - well Grizzly is another framework which can be used as an HTTP/web server using Java NIO model. To use Jersey with Grizzly, you need to configure it accordingly. So think of Grizzly as the container of your JAX-RS (RESTful) resources and the one which takes care of all the HTTP plumbing for you while you work with high level abstractions of the JAX-RS API

Jersey on Tomcat - now Tomcat is a Servlet container. JAX-RS can easily be configured to work with plain Servlet container by just configuring the web.xml of your Tomcat application.

Jersey on a Java EE container - take the example of Glassfish which is the RI (Reference Implementation) for Java EE platform. Jersey is bundled out of the box in Glassfish. Thus in order to build RESTful application on a Java EE server, you just need to write your business logic (REST services) and deploy your project (EAR/WAR) on the server - no additional plumbing/configuration required (except in special scenarios)

Hope that made some sense ? :-)

like image 85
Abhishek Avatar answered Nov 13 '22 22:11

Abhishek