Overview of JAX-RS
To write RESTful web services in Java, need only a client and a server that support the HTTP. Any browser and an HTTP servlet container do it at some cost of XML configuration. So that the code hardly readable and supportable. This is where JAX-RS comes to the relief. With just a few annotations get the full power of invoking HTTP resources and parsing them.
The first version of the JAX-RS specification (JSR 311), finalized in October 2008, defined a set of APIs that promoted the REST architecture style. While it only covered the server-side manner of REST. So with the Java EE 7, JAX-RS has been updated to a 2.0 version and defines a client API.
Explain Java API for RESTful Web Services with their key features ?
For building web services, follow to the REST style the Java API for REST (JAX-RS) specification defines a set of Java APIs.
And how to expose POJOs as web resources this specification defines, using HTTP as the network protocol. By using these APIs applications can be deployed to an application server in a convenient manner.
Some of the key features are:
- Converting POJOs to RESTful resources
- More on JAX-RS annotations
- Client API for JAX-RS
- Entities in JAX-RS
- Custom entity providers in JAX-RS
- Use of Bean Validation API with JAX-RS
What are the main JAX-RS packages ?
The main JAX-RS packages along with their descriptions:
- javax.ws.rs
To create RESTful web service use the high-level interfaces and annotations. - javax.ws.rs.client
Classes and interfaces of the new JAX-RS client API. - javax.ws.rs.container
Container-specific JAX-RS API. - javax.ws.rs.core
Low-level interfaces and annotations used to create RESTful web resources. - javax.ws.rs.ext
APIs that provide extensions to the types supported by the JAX-RS API.
Name the implementations of JAX-RS ?
Jersey is the reference implementation of JAX-RS. It is an open source project under dual CDDL and GPL licenses.
Jersey also provides a specific API so that you can extend Jersey itself. Other implementations of JAX-RS are also available such as CXF , RESTEasy , and Restlet.
What are the main JAX-RS 2.0 annotations added in Java EE 7 ?
Annotations with their descriptions:
- @Path
- @Produces
- @Consumes
- @GET, @POST, @DELETE
- @PathParam
- @ApplicationPath
- @Context