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?
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!" } }
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.
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 ? :-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With