Liberty profile: JAX-RS

You can use Java™ API for RESTful Web Services (JAX-RS) in the Liberty profile.

Implementing JAX-RS web applications
You can use JAX-RS to develop services that follow Representational State Transfer (REST) principles. Using JAX-RS, development of RESTful services is simplified.
For more information, see the WebSphere® Application Server full profile topic Implementing JAX-RS web applications; the "Configuring the development environment" section in the topic is not relevant to the Liberty profile. To make the configuration change on Liberty, you must add the features to the server.xml file as follows:
 <feature>jaxrs-1.1</feature>
 <feature>json-1.0</feature> 
In addition:
Using XML content in JAX-RS application requests and responses
XML is a common media format that RESTful services consume and produce. To deserialize and serialize XML, you can represent requests and responses by Java Architecture for XML Binding (JAXB) annotated objects.
For more information, see the WebSphere Application Server full profile topic Using XML content in JAX-RS application requests and responses; the "Configuring the development environment" section in the topic is not relevant to the Liberty profile.
Using Atom content in JAX-RS application requests and responses
You can use the Atom Syndication Format (Atom) to format web feeds, which communicate news and updates of episodic information about websites. Using Atom content in JAX-RS applications, you can take advantage of web content syndication that provides the same decentralized, dynamic mechanisms for adding new metadata and content supported by RSS, but does so in a way that helps protect core interoperability between implementations.
For more information, see the WebSphere Application Server full profile topic Using Atom content in JAX-RS application requests and responses; the "Configuring the development environment" section in the topic is not relevant to the Liberty profile.
Using custom entity formats
Even though the JAX-RS runtime environment includes several entity providers for handling serialization from and deserialization to Java types, it does not support all possible media types. You can develop a custom entity provider to handle binding Java types to message bodies.
For more information, see the WebSphere Application Server full profile topic Using custom entity formats; the "Configuring the development environment" section in the topic is not relevant to the Liberty profile.
Using content negotiation to serve multiple content types in JAX-RS applications
One of the advantages of RESTful applications is the ability to return different representations of resources. With Representational State Transfer (REST), clients and servers can exchange resources of the same media type or use differing media types. Content negotiation enables clients and servers to agree on the content format that is used to exchange data.
For more information, see the WebSphere Application Server full profile topic Using content negotiation to serve multiple content types in JAX-RS applications; the "Configuring the development environment" section in the topic is not relevant to the Liberty profile.
Using JAX-RS context objects to obtain more information about requests
JAX-RS provides different types of context to resource classes and providers. You can use context objects to access request information such as discovering the HTTP headers that are sent as part of the request. Context objects also provide convenience methods for evaluating a request and building an appropriate response.
For more information, see the WebSphere Application Server full profile topic Using JAX-RS context objects to obtain more information about requests; the "Configuring the development environment" section in the topic is not relevant to the Liberty profile.
Using handlers to enhance request and response processing
You can implement handlers on the server-side of a JAX-RS application to enhance request and response processing.
For more information, see the WebSphere Application Server full profile topic Using handlers to enhance request and response processing; the "Configuring the development environment" section in the topic is not relevant to the Liberty profile.
Using multipart content in JAX-RS application requests and responses
Using multipart messages, servers and clients can transmit multiple messages using a single message. Multipart messages are useful when both the client and server need to send multiple requests but want to save the cost of sending and receiving entire HTTP request and responses for each part.
For more information, see the WebSphere Application Server full profile topic Using multipart content in JAX-RS application requests and responses; the "Configuring the development environment" section in the topic is not relevant to the Liberty profile.
Using multipart/form-data content in JAX-RS application requests and responses
A frequently used content type for submitting files through an HTML form is multipart/form-data. The JAX-RS implementation from IBM® greatly simplifies the processing of such data by automatically splitting the parts and automatically decoding them. If such automatic processing is not wanted, the resource can instead receive the parts in an object so processing of the parts is under the complete control of the resource method.
For more information, see the WebSphere Application Server full profile topic Using multipart/form-data content in JAX-RS application requests and responses; the "Configuring the development environment" section in the topic is not relevant to the Liberty profile.
Implementing secure JAX-RS applications
The JAX-RS runtime environment from IBM is driven by a servlet derived from the Apache Wink project. Within the WebSphere Application Server environment, the lifecycle of servlets is managed in the web container. Therefore, the security services offered by the web container are applicable to REST resources that are deployed in WebSphere Application Server.
For more information, see the WebSphere Application Server full profile topic Implementing secure JAX-RS applications; the "Configure the development environment", "Secure JAX-RS resources using annotations", "Secure JAX-RS clients using SSL", and "Administer the secure JAX-RS application" sections in the topic are not relevant to the Liberty profile, and, in addition:
  • In Securing JAX-RS applications within the web container, the reference to the directory structure for the AddressBookApp deployment descriptor is not relevant to the Liberty profile. After you install the AddressBookApp application in the Liberty profile, the WEB-INF\web.xml file of the web application looks like the example provided in the link.
  • In the Liberty profile, the default context root is the name of the WAR file. For more information about options when configuring context roots, see Deploying a web application to the Liberty profile.
Using WADL to generate service documentation
Web Application Description Language (WADL) is a description language for HTTP-based applications. It is currently a World Wide Web Consortium (W3C) Member Submission. WADL can be used by programs to give information about the service in a machine-processable method. For instance, you can use an XSLT document to transform the WADL documentation by using a custom XSLT and an XSLT processor.
For more information, see the WebSphere Application Server full profile topic Using WADL to generate service documentation; the "Configuring the development environment" section in the topic is not relevant to the Liberty profile.
Using the Apache Wink REST client inside server applications to issue requests
You can use the Apache Wink REST client as a client that can be run to send requests to your JAX-RS application.
For more information, see the WebSphere Application Server full profile topic Using the Apache Wink REST client inside server applications to issue requests; any references in the topic to thin client, unmanaged client, or administrative console are not relevant to the Liberty profile.
Note: If you use the jaxrs-1.1 feature, you must specify the servlet-3.0 or jsp-2.2 features separately.

Icon that indicates the type of topic Reference topic

Terms and conditions for information centers | Feedback


Timestamp icon Last updated: Monday, 21 April 2014
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=phil&product=was-nd-mp&topic=rwlp_jaxrs
File name: rwlp_jaxrs.html