RESTful Web Services Developer's Guide

Chapter 1 Introduction to RESTful Web Services and Jersey

This chapter describes the REST architecture, RESTful web services, and Sun's reference implementation for JAX-RS (JavaTM API for RESTful Web Services, JSR-311), which is referred to as Jersey.

What Are RESTful Web Services?

RESTful web services are services that are built to work best on the web. Representational State Transfer (REST) is an architectural style that specifies constraints, such as the uniform interface, that if applied to a web service induce desirable properties, such as performance, scalability, and modifiability, that enable services to work best on the Web. In the REST architectural style, data and functionality are considered resources, and these resources are accessed using Uniform Resource Identifiers (URIs), typically links on the web. The resources are acted upon by using a set of simple, well-defined operations. The REST architectural style constrains an architecture to a client-server architecture, and is designed to use a stateless communication protocol, typically HTTP. In the REST architecture style, clients and servers exchange representations of resources using a standardized interface and protocol. These principles encourages RESTful applications to be simple, lightweight, and have high performance.

RESTful web services typically map the four main HTTP methods to the operations they perform : create, retrieve, update, and delete. The following table shows a mapping of HTTP methods to the operations they perform.

Table 1–1 Mapping HTTP Methods to Operations Performed

HTTP Method 

Operations Performed 

GET 

Get a resource 

POST 

Create a resource and other operations, as it has no defined semantics 

PUT 

Create or update a resource 

DELETE 

Delete a resource 

How Does Jersey Fit In?

Jersey is Sun's production quality reference implementation for JSR 311: JAX-RS: The Java API for RESTful Web Services. Jersey implements support for the annotations defined in JSR-311, making it easy for developers to build RESTful web services with Java and the Java JVM. Jersey also adds additional features not specified by the JSR.

The latest version of the JAX—RS API's can be viewed at https://jsr311.dev.java.net/nonav/javadoc/index.html

Learning More About RESTful Web Services

The information in this guide focuses on learning about Jersey. If you are interested in learning more about RESTful Web Services in general, here are a few links to get you started.

Some of the Jersey team members discuss topics out of the scope of this tutorial on their blogs. A few are listed below:

You can always get the latest technology and information by visiting the Java Developer's Network. The links are listed below: