Home > SOA Tips > The Web Services Advisor > Restlet framework wrestles RESTful Web applications
SOA Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

Restlet framework wrestles RESTful Web applications


William Brogden
Rating: --- (out of 5)

Few dissertations have had an impact comparable to that of Roy Fielding'sArchitectural Styles and the Design of Network-based Software Architectures nine years ago. In Chapter 5 he developed the Representational State Transfer (REST) view of network architecture. As the REST way of looking at Web services architecture percolated through the developer community, many developers felt inspired. Before looking at Restlet, one of the first toolkits inspired by REST, lets consider the requirements of REST as stated by Fielding.

The most important requirements have to do with the use of a limited number of strictly defined operations. For Web services, these are the HTTP methods GET, POST, PUT, DELETE, OPTIONS, and HEAD. For example, by strict REST style, the GET operation only returns a representation of the state of a resource without causing any side effect.

Other requirements have to do with the rep...


RELATED CONTENT
The Web Services Advisor
Where does BPEL fit in?
Some notes on ESB configuration
Open source application development frameworks offer alternatives
What to expect with the new JavaScript standardization (ECMAScript 5)
3 tips for choosing whether to use EGL
Use SoaML to facilitate Model Driven Architecture
Enterprise mashup patterns act as API enablers
XQuery learns to write using XUF
Descriptive Languages for RESTful Services
Notable Python language update on view

Representational State Transfer (REST)
IBM REST engine taps into Microsoft-backed OData protocol
Mulesoft architect talks REST, ESBs
How do I balance throughput requirements and interoperability?
IBM Sabbah's say on REST for collaborative ALM
Report on REST- REpresentational State Transfer
Are tools available to work with OSGi today?
Expert Query: What is the difference between RESTful transactions and Web Services transactions?
Progress/Actional SOA diagnostic tool builds on Mindreef purchase
SOA goes beyond 'rip, replace, repeat'
Inside the SOA big tent; Azure at PDC; more

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
REST  (SearchSOA.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


resentation of a resource. We need to recognize that a resource can have a number of representations. For example, economic statistics might take the form of graphic images in a variety of formats or data formatted for a spreadsheet. HTTP provides the header "Accept" to define the Internet media types a request will accept, "Accept-Charset" to define acceptable character encodings, and "Content-Type" to define response media type. Other headers can supply metadata about a resource, such as the "Last-Modified" date. HTTP status codes provide a well-defined short-form way to inform a requesting client how the request has been handled. Ideally a REST programming toolkit would make it easy use of HTTP headers and status codes to support REST concepts.

The Restlet framework
Development of the Java-based Restlet framework was started by Jerome Louvel, founder of Noelios Technologies, a French consulting firm. In an arrangement common to many open source tools, Noelios supports open source community development while supplying clients with expert assistance in creating applications. The API and reference implementation code are distributed under the CDDL (Common Development and Distribution License), a form of licensing compatible with Sun's Public License, and considered more liberal for commercial use than the GPL.

The original intent of Restlet was to support the REST concepts elucidated by Fielding as directly as possible with Java classes representing the component parts of Fielding's diagrams. Work started in 2005, before anything like the JSR 311, the Java API for RESTful Web Services, existed. Jerome Louvel was one of the developers supporting the Java Community Project work on initial drafts of JSR 311, but that project had only just started when the Restlet version 1.0 framework was released in April 2007. Although an early release, it had support for many important concepts, including data representation in XML, HTML and JSON forms, support of both HTTP and HTTPS connectivity, and authentication. A Restlet with direct support of Java's NIO (non-blocking IO) classes avoided the existing servlet API's limitations of one Thread per request. A Restlet application can run as stand-alone or as a component of a larger container. Furthermore, the class library was designed to support both server and client and server side applications.

The work of the JSR 311 group was reflected in Restlet release 1.1 in October of 2008, coincident with the final release of the JAX-RS standard. Major changes were required to add the use of annotations to Restlet classes. Annotations, which were introduced with Java version 1.5, allow a service container to locate the classes and methods capable of fulfilling a given request. The following example from Restlet documentation shows annotation of two methods. The container will pick the method to call to satisfy a GET request according to the "Accept" header.

Other improvements included support for theWeb Application Description Language (WADL), including provision for services to generate WADL documentation on request.

Restlet Version 2
Originally conceived as version 1.2, the number of changes warrented a major version number. As of this writing, Restlet version 2 has reached the "Milestone 4" release. This major redesign of the Restlet framework is intended to achieve API simplifications and improvements based on experiences with version 1.1, and incorporate contributions by many enthusiastic developers. There has been a vast expansion of compatibility for integration with many popular toolkits, response media types, and servlet container alternatives.

An important feature of this new release is the availability of distribution packages tailored for different environments but all derived from the same code base. As of Milestone 4, there are editions specificaly tailored for Java Standard Edition, Java Enterprise Edition, Google Web Toolkit (browser-side JavaScript), Google App Engine (cloud server), and Google's Android operating system for cell phones. Note that we are talking about both server-side and client-side tools, reflecting the Restlet philosophy that server and client side of RESTful applications should share as much code as possible.

Resources
What Roy Fielding is up to these days
RFC 2616, the HTTP/1.1 standard.
Home page for Restlet at Noelios Technologies
Restlet framework home page is essentially an alternate Noelios site
The RESTful Web Services book (May 2007) includes Restlet 1.0 examples
Sun's tutorial on the use of annotations
Sun support for WADL in the Glassfish project

Rate this Tip
To rate tips, you must be a member of SearchSOA.com.
Register now to start rating these tips. Log in if you are already a member.




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



SOA Trends and Strategy - SOA Education, SOA Development, SOA Implementations
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2001 - 2010, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts