Planning to use JAX-RS to enable RESTful services

By using the Java™ API for RESTful Web Services (JAX-RS) API, application developers can quickly develop RESTful applications. When planning to use JAX-RS to enable RESTful services, consider how to best implement the capabilities and characteristics of a RESTful application with JAX-RS.

Before you begin

Read the overview of JAX-RS information to learn about REST services and the advantages of using JAX-RS to build RESTful services.

About this task

JAX-RS is a programming model that provides a mechanism for developing services that follow Representational State Transfer (REST) principles. Using JAX-RS, development of RESTful services is simplified.

JAX-RS is a Java API for developing REST applications quickly. While JAX-RS provides a faster way for developing web applications than servlets, the primary goal of JAX-RS is to build RESTful services. JAX-RS 1.0 defines a server-side component API to build REST applications. IBM® JAX-RS provides an implementation of the JAX-RS (JSR 311) specification.

By using JAX-RS technology, REST applications are simpler to develop, simpler to consume, and simpler to scale when compared to other types of distributed systems. Many popular and widely used Internet services have successfully provided RESTful APIs to their applications. Third parties have used various REST APIs to build their own businesses and applications.

Due to the simple consumption of RESTful services, you can write clients in many languages on different platforms. Most languages require no third-party libraries as long as there is a method to use an HTTP connection. Because of the pervasiveness of web browsers, the most prevalent clients are typically web browsers. For example, many Web 2.0 properties use a JavaScript framework such as Dojo toolkit for developing a client in a browser in conjunction with a RESTful server-side application that provides the data for the client.

Procedure

  1. Review existing business and middleware applications in your environment to determine which services you want to implement as REST services.
  2. Define the resources in your RESTful applications.
  3. Determine the URL patterns, operations, and media type formats to use for each resource.
    1. Define the URI patterns for resources in RESTful applications.
    2. Define the client capabilities for RESTful applications using HTTP methods .
    3. Define the HTTP headers and response codes for RESTful applications using HTTP methods.

Results

You have a design plan for using JAX-RS to implementing REST services.