Deploying JAX-RS 2.0 applications to Liberty
You can use Java™ API for RESTful Web Services
(JAX-RS) to develop services that follow Representational State Transfer (REST) principles. RESTful
services are based on manipulating resources. Resources can contain static or dynamically updated
data. By identifying the resources in your application, you can make the service more useful and
easier to develop. Liberty provides
jaxrs-1.1
and jaxrs-2.0
to support the JAX-RS programming model.
Asynchronous processing
Configuring a resource to receive multipart/form-data parts from an HTML form submission in JAX-RS 2.0
HTML forms that transmit file data must be configured with the POST method and the "multipart/form-data" action. The resource method executing in IBM's implementation of the Java™ API for RESTful Web Services (JAX-RS) specification can receive this data in one of the two ways.
Configuring JAX-RS 2.0 client
For Java API for XML RESTful Web Services 2.0, you can configure the client to access REST endpoints. JAX-RS 2.0 introduces a new and standardized Client API so that you can make http requests to your remote RESTful web services.
Deploying EJB in an EAR file for JAX-RS 2.0
In Liberty , JAX-RS 2.0 supports EJB JAX-RS in EJB JAR file that must be included in an EAR file.
Implementation of JAX-RS 2.0 web applications
You can use Java API for RESTful Web Services (JAX-RS) to develop services that follow Representational State Transfer (REST) principles. Using JAX-RS, development of RESTful services is simplified.
Implementation of secure JAX-RS applications
The IBM® JAX-RS 1.1 runtime environment is driven by a servlet that is derived from the Apache Wink project. The JAX-RS 2.0 runtime environment is driven by a servlet derived from the Apache CXF. Within the WebSphere® Application Server environment, the lifecycle of servlets is managed in the web container. Therefore, the security services that are offered by the web container are applicable to REST resources that are deployed to WebSphere Application Server .
JAX-RS 2.0 behavior changes
As a part of Java EE 7, Liberty supports JAX-RS 2.0. Before beginning to use JAX-RS in Liberty , you might need to know the following differences between JAX-RS 1.1 and JAX-RS 2.0.
JAX-RS 2.0 integration with Atom
JAX-RS 2.0 can use Apache Abdera to add Atom support.
JAX-RS 2.0 integration with EJB and CDI
JAX-RS 2.0 in Liberty integrates with Enterprise JavaBeans (EJB) and Contexts and Dependency Injection (CDI).
JAX-RS 2.0 integration with managed beans
JAX-RS 2.0 in Liberty supports the use of managed beans as root resource classes, providers, and application subclasses.
Sending multiple query parameters from Client - Cascaded or Iterated programming
You can see the following sample if you want to send multiple query parameters from the client side to the server.
Using JAX-RS 2.0 context objects to obtain more information about requests
Java API for RESTful Web Services (JAX-RS) 2.0 provides different types of context to application subclasses, root resource classes, and providers. You can use the @Context
annotation to inject context objects such as HttpHeaders, UriInfo, HttpServletRequest into class field or method parameter in application subclasses, root resource classes, and providers.
WADL2JAVA command
The wadl2java command line tool processes an existing Web Application Description Language (WADL) file and generates the required artifacts for developing Java API for RESTful Web Services (JAX-RS) web service applications. The wadl2java command line tool supports the top-down approach to developing JAX-RS web services. When you start with an existing WADL file, use the wadl2java command line tool to generate the required JAX-RS artifacts.