Summary
A new JSR was submitted for review to the JCP, promising a standard API to build Java services that conform to the REST invocation style. Headed by Sun, the expert group includes Restlet creator Jerome Louvel, and corporate expert group members include Apache, BEA, Google, JBoss, and TmaxSoft.
Advertisement
The REST style invocation of Web services, popularized by Roy Fielding's work on Web architecture, is becoming an increasing popular alternative to SOAP and other RPC-style Web service invocations. Its proponents claim that REST provides a simpler invocation interface, takes better advantage of the widely-used HTTP protocol, and facilitates more scalable Web service implementations.
Thus far the main ways to build Java Web services that adhere to the REST design principles have been either to create a custom implementation on top of the Servlet API, or to use Jerome Louvel's Restlet framework.
In an interview with Artima, Jerome Louvel on the Restlet Project, Louvel bemoaned the difficulty of using the Servlet API for RESTful services:
As I started the development of a new Web site, I wanted to comply with the REST architectural style... This led me to develop my own REST framework on top of the Servlet API. This worked well up to a point where the Servlet API was completely hidden. [Then] I decided to completely bypass the Servlet API. Fortunately, Jetty has a nice separation between its HTTP protocol implementation and its support for the Servlet API. In the end, I was able to develop the first Restlet connector, an HTTP server connector, directly issuing REST uniform calls.
The Restlet project provides both an API and an implementation based on Louvel's work.
With the recently proposed JSR 311: Java API for RESTful Web Services, RESTful Web services may finally have an official standard API and implementation. According to JSR 311's project's description,
This JSR will aim to provide a high level easy-to use API for developers to write RESTful web services independent of the underlying technology and will allow these services to run on top of the Java EE or the Java SE platforms. The expert group will investigate whether a subset of the API can be made [for use] with Java ME. The goal of this JSR is to provide an easy to use, declarative style of programming using annotations for developers to write RESTful Web Services and also enable low-level access in cases where needed by the application.
Do you agree that building RESTful services in Java is hard? And you see the need for a separate REST-focused Java API?
Thanks Franck for discussion the relationship between JSR#311 and the Restlet API. The way I understand the proposed JSR is that it aims at providing a higher-level API for RESTful HTTP web services. I have provided an explanation diagram in this blog post: http://blog.noelios.com/2007/02/14/new-jsr-to-define-a-high-level-rest-api-for-java/
This would be quite complimentary to the Restlet API which could provide the lower-level API that is mentionned in the JSR and that might become necessary for complete specification of JSR#311. I will discuss this aspect with the Expert Group and will propose to submit the Restlet JSR in parallel if it can help and complement JSR#311.