ChapterÂ 14.Â JAX-RS Implementations
The JAX-RS specification has been final for over a year now and there are a bunch of implementations out there that you can download and try. This chapter provides an overview of the most popular implementations by highlighting various custom features of each provider. It isnât meant as documentation for each of the frameworks described, but rather to show you some of the innovations that are going on in the JAX-RS community.
Jersey is the open source reference implementation of JAX-RS. It is dual-licensed under both the Common Development and Distribution License (CDDL) version 1.0 and the GNU General Public License (GPL) version 2.
Jersey is built, assembled, and installed using Maven. The main project site, https://jersey.dev.java.net, contains a download button that links to instructions on how to get started with Jersey, its prerequisites, and links to samples. Jersey is also shipped with the application server GlassFish.
While Jersey is usually deployed within a servlet container, it
can also be embedded within simple Java programs. The following Java
class represents a very simple example that uses the Grizzly embedded
HTTP server to deploy a root resource class called
MyResource. It uses the Jersey Client API to
communicate with the resource:
import com.sun.grizzly.http.SelectorThread; import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.WebResource; import com.sun.jersey.api.container.grizzly.GrizzlyServerFactory; ...