Wikipedia defines Representational State Transfer (REST) as "a style of software architecture for distributed hypermedia...
systems such as the World Wide Web." The RESTful approach to Web services is widely seen as a simpler alternative to SOAP. Many big name Web services providers such as Amazon, Twitter and Google use the RESTful approach extensively. If you are contemplating getting a REST style Web service project started, but don't want to reinvent the wheel, you need to know about existing well established tools.
As elucidated by Fielding in his PhD Dissertation in 2000, the principles of RESTful Web services are really rather simple. You combine the basic HTTP methods with addressing which can specify a resource and you have the basics of a RESTful service. So, why have people created all these various frameworks for creating and consuming RESTful services? These frameworks have been created to make it easier for developers working with a variety of other industry standards to get started with RESTful services. New REST frameworks pop up all the time, but here I describe the current state of three mature frameworks.
Jersey Project and the JAX-RS Standard
Java developers have been evolving the Java API for RESTful Web services or JAX-RS for some time in association with the JSR-311 specification. The current version was released in 2008 with a version 1.1 maintenance update in November 2009. This specification shows how to add annotations to a normal Java class so it can be expressed as part of a RESTful Web service. Annotations are a special syntax used to label sections of Java code which allow a service container to dynamically locate the class and method which will satisfy a RESTful style request.
The reference implementation is under development by the Jersey project which is part of Sun's (now Oracle's) open source implementation of the Java Enterprise Edition (JEE). An active developer community has just released Jersey version 1.3, which implements JAX-RS 1.1, but the documentation has not caught up with all of the new features. Version 1.3 has reorganized the code for easier integration into the latest version of GlassFish, the open source reference version of Java Enterprise Edition 6. Note that Jersey can easily be added to existing Tomcat 6 installations without disturbing existing applications. Both the Eclipse and NetBeans IDEs provide for Jersey project development and a search will easily locate Jersey tutorials using both. The Jersey toolkit includes classes for implementing the client side for generating HTTP requests and interpreting responses from RESTful Web services.
The Jersey project is attempting to popularize the Web Application Description Language (WADL) as a simpler RESTful equivalent to WSDL for describing the resources a service provides. This XML formatted service description can be generated by a Jersey service and optionally extended by the developer. It is intended to make it easy to create client software to access a Jersey service. As far as I can tell, WADL has not yet been extensively adopted. The major Web services exposing a RESTful interface, such as Twitter, publish plain text descriptions of services with examples in various languages.
Restlet version 2.0
The Restlet framework was started as an open source project well before the JSR-311 committee got organized. When I last looked, the Restlet framework version 1.1 was the current but version 2 was nearly ready for release. Version 2.0 (just released in July 2010) accomplished a major revision of the organization of packages and simplification of the API. This reorganization makes it possible to use one code base to create five different editions. Each edition contains support for the basic Restlet classes plus various extensions as appropriate for each working environment:
- Java Standard Edition (JSE)
- Java Enterprise Edition (JEE)
- Google App Engine
- Google Web Toolkit (GWT)
The Restlet developers have been busy increasing the number of extensions to support industry standards. The version 2.0 Restlet framework supports the JAX-RS 1.0 API and also the Open Data Protocol (OData) currently being developed by Microsoft. The Restlet client API emphasizes using the same interfaces which the server side uses. This approach is in dramatic contrast with that used by Jersey and other REST clients which tend to emulate the functions of an HTTP browser client. Restlet documentation gives extensive examples of development with various IDEs.
IBM's Project Zero and sMash for WebSphere
Project Zero has evolved quite rapidly since I last took a look at it. The incubator project aimed at rapid (Zero complexity, Zero overhead, Zero obstacles) development has evolved into a product called IBM WebSphere sMash while the development community continues as Project Zero. Note that Project Zero is not open source, but provides a way for developers to feed ideas into the sMash commercial product, while taking advantage of open-source tools such as Groovy, Dojo and PHP.