1 Introduction to RESTful Web Services

RESTful web services are Java EE web services that you develop to conform to the Representational State Transfer (REST) architectural style using Java API for RESTful Web Services (JAX-RS).

Introduction to the REST Architectural Style

REST describes any simple interface that transmits data over a standardized interface (such as HTTP) without an additional messaging layer, such as Simple Object Access Protocol (SOAP). REST is an architectural style—not a toolkit—that provides a set of design rules for creating stateless services that are viewed as resources, or sources of specific information (data and functionality). Each resource can be identified by its unique Uniform Resource Identifiers (URIs).

A client accesses a resource using the URI and a standardized fixed set of methods, and a representation of the resource is returned. A representation of a resource is typically a document that captures the current or intended state of a resource. The client is said to transfer state with each new resource representation.

Table 1-1 defines a set of constraints defined by the REST architectural style that must be adhered to in order for an application to be considered "RESTful."

Table 1-1 Constraints of the REST Architectural Style

Constraint Description


Identifies all resources using a uniform resource identifier (URI). In the English language, URIs would be the equivalent of a noun.

Uniform interface

Enables the access of a resource using a uniform interface, such as HTTP methods (GET, POST, PUT, and DELETE). Applying the English language analogy, these methods would be considered verbs, describing the actions that are applicable to the named resource.

Client-server architecture

Separates clients and servers into interface requirements and data storage requirements. This architecture improves portability of the user interface across multiple platforms and scalability by simplifying server components.

Stateless interaction

Uses a stateless communication protocol, typically Hypertext Transport Protocol (HTTP). All requests must contain all of the information required for a particular request. Session state is stored on the client only.

This interactive style improves:

  • Visibility—Single request provides the full details of the request.

  • Reliability—Eases recovery from partial failures.

  • Scalability—Not having to store state enables the server to free resources quickly.


Enables the caching of client responses. Responses must be identified as cacheable or non-cacheable. Caching eliminates some interactions, improving efficiency, scalability, and perceived performance.

Layered system

Enables client to connect to an intermediary server rather than directly to the end server (without the client's knowledge). Use of intermediary servers improve system scalability by offering load balancing and shared caching.

What are RESTful Web Services?

RESTful web services are services that are built according to REST principles and, as such, are designed to work well on the Web.

RESTful web services conform to the architectural style constraints defined in Table 1-1. Typically, RESTful web services are built on the HTTP protocol and implement operations that map to the common HTTP methods, such as GET, POST, PUT, and DELETE to retrieve, create, update, and delete resources, respectively.

Standards Supported for RESTful Web Service Development on WebLogic Server

The JAX-RS provides support for creating web services according to REST architectural style. JAX-RS uses annotations to simplify the development of RESTful web services. By simply adding annotations to your web service, you can define the resources and the actions that can be performed on those resources. JAX-RS is part of the Java EE 7 full profile, and is integrated with Contexts and Dependency Injection (CDI) for the Java EE Platform (CDI), Enterprise JavaBeans (EJB) technology, and Java Servlet technology.

WebLogic Server supports the following JAX-RS API and Reference Implementation (RI):

  • JAX-RS 2.0 Rev a

  • Jersey 2.22.4


Jersey 2.x (JAX-RS 2.0 RI) support is provided by default in this release of WebLogic Server. Registration as a shared library is no longer required.

The Jersey 1.x server-side APIs are no longer supported. You should use the corresponding standard JAX-RS 2.0 or Jersey 2.x APIs instead. The Jersey 1.x client API is deprecated. It is recommended that you update your RESTful client applications to use the JAX-RS 2.0 client APIs at your earliest convenience.

The Jersey 2.x (JAX-RS 2.0 RI) includes the following functionality:

  • Jersey


  • JSON processing and streaming

Table 1-2 lists key features delivered with Jersey 2.x (JAX-RS 2.0 RI).

Table 1-2 Key Features in Jersey 2.x (JAX-RS 2.0 RI)

Key Feature Description

Client API

Communicate with RESTful web services in a standard way. The Client API facilitates the consumption of a web service exposed via HTTP protocol and enables developers to concisely and efficiently implement portable client-side solutions that leverage existing and well established client-side HTTP connector implementations.

For complete details, see:

Asynchronous communication

Invoke and process requests asynchronously.

For complete details, see:

Filters and interceptors

Using filters, modify inbound and outbound requests and responses., such as header information. Using interceptors, modify entity input and output streams. Filters and interceptors can be used on both the client and server side.

For complete details, see Filters and Interceptors in the Jersey 2.22 User Guide.

For more information about JAX-RS and samples, see Learn More About RESTful Web Services.

Roadmap for Implementing RESTful Web Services

Review a roadmap of common tasks for developing, packaging and deploying, securing, and monitoring RESTful web services and clients. These tasks are listed in Table 1-3.

Table 1-3 Roadmap for Implementing RESTful Web Services and Clients

Task More Information

Develop RESTful web services.

Developing RESTful Web Services

Develop clients to invoke the RESTful web services.

Summary of Tasks to Develop RESTful Web Service Clients

Package and deploy RESTful web services.

Secure RESTful web services.

Test RESTful web services.

Testing RESTful Web Services

Monitor RESTful web services.

Monitoring RESTful Web Services and Clients

(Optional) Migrate existing applications from Jersey 1.x to 2.x.

Migration Guide in Jersey 2.22 User Guide

Learn More About RESTful Web Services

Additional information about RESTful web services is available from resources such as the Community Wiki for Project Jersey, jcp.org, the JSR-339 JAX-RS 2.0 Specification, and more. These resources are listed in Table 1-4.

Table 1-4 Resources for More Information

Resource Link

Jersey User Guide

Jersey 2.22 User Guide

Jersey API Javadoc

Jersey 2.22 API Documentation

Community Wiki for Project Jersey


JSR-339 JAX-RS 2.0 Specification


JAX-RS API Javadoc


JAX-RS Project


RESTful Web Services (JAX-RS) sample

Sample Application and Code Examples in Understanding Oracle WebLogic Server.

The Java EE 7 Tutorial—Building RESTful Web Services With JAX-RS


"Representational State Transfer (REST)" in Architectural Styles and the Design of Network-based Software Architectures (Dissertation by Roy Fielding)