The Artima Developer Community
Sponsored Link

Java Community News
Jerome Louvel on the Restlet Project

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Frank Sommers

Posts: 2642
Nickname: fsommers
Registered: Jan, 2002

Jerome Louvel on the Restlet Project Posted: Nov 14, 2006 11:52 AM
Reply to this message Reply
Summary
The Restlet project aims to make building RESTful Web applications in Java easier. Restlet is both a Java-based API for REST, and an implementation of that API. In preparation for a 1.0 release in December, the project released its 1.0 Beta 20 last week. Artima asked project founder Jerome Louvel about Restlet's goals and notable features.
Advertisement

Ever since Roy Fielding expounded the principles of REST, or Representational State Transfer, the architectural principles underlying Fielding's thesis have gathered a strong following. REST is viewed by many as an ideal Web architecture, capable of taking advantage of the Web's full scalability potential. Yet, few real-world Web applications follow completely the REST principles, if only because popular Web application tools, such as the Java Servlet API, do not make it easy to create fully RESTful applications.

The open-source Restlet project fills the void in high-quality RESTful frameworks. Jerome Louvel started up the project because, as he recalls on the project's documentation pages, he could not find satisfactory REST support in existing Web frameworks:

As I started the development of a new Web site, I wanted to comply with the REST architectural style as much as technically possible. After [much research], I noted the lack of a REST framework in Java... 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 made its first source release in November, 2005, and has been growing ever since. The project released last week its 1.0 beta 20 version. Artima spoke with Louvel about the project's goals, its current status, and notable features in the latest release:

Our first goal is to bring REST into the hands of Java developers building real applications. REST is an architecture style that was defined by Roy T. Fielding in the context of his Ph.D. dissertation. While it is considered ... a masterpiece defining the core principles of Web architecture, it is rather abstract and [is] hard to learn. Our second goal is to provide a modern alternative to the Servlet API. We have a lot of respect for this API, which is probably the most successful one in [Java] EE, but we also think that it’s time to move on and provide a modern alternative, taking full advantage of NIO and learning from the past mistakes.

About the project's main goal—to make it easier to build RESTful Java applications—Louvel noted that:

The current practice is to apply REST to the HTTP and URI standards, even if REST is more generic than that. The HTTP protocol is a powerful but complex application-level protocol that you need to truly understand and respectfully handle to be RESTful. However, the Servlet API views [HTTP] as a bare transport protocol, [and] forces you to manually handle the raw HTTP headers.

For example, implementing content negotiation to return the best representation of a resource according to the current client preferences is a serious challenge when you work with a basic Servlet engine. With Restlets, you don’t need to play with raw headers, you simply create your resource by sub-classing the Resource class and provide a set of potential representations with the getVariants() method. The framework can then automatically return the best representation for the current client preferences.

Restlets are suitable for both server-side and client-side applications. It is truly a Web-centric framework. While it provides full support for HTTP, it is also protocol independent, with connectors available for HTTP(S), SMTP(S), JDBC, FILE and ClassLoaders. We are also planning to add support for JMS and JNDI in the future.

Louvel pointed out that Restlet defines a general REST-based Java API, in addition to providing an implementation of that API in the form of the Restlet Engine:

This separation is comparable to the one between the Servlet API and engines like Tomcat. We don’t want to build another framework that will lock you in their implementation. Currently, there is only one implementation, the Noelios Restlet Engine, but other organizations and companies are welcome to develop their own. The API is freely available under the CDDL license, even for commercial usage. By the end of the year, we will also submit a request to the Java Community Process to standardize a version 2.0 of the API.

We [also] provide an adapter between the Restlet API and the Servlet API that lets you easily deploy your Restlet applications in Tomcat or any other Servlet engine. Many users prefer that to directly relying on our standalone HTTP server connectors which are based on the proven Jetty, AsyncWeb and Simple HTTP engines.

URI templates, support for Velocity, FreeMarker, and JSON, as well as support for the Amazon Web services are among the most recent release's notable features, according Louvel:

For REST applications, URIs are fundamental, [and] often contain dynamic parts in their path, such as the ID of a customer, for example http://example.org/customer/2983/details. When routing requests to the appropriate handler, you can now directly declare URI patterns in addition to Java Regex expressions. For example /customers/{customerId}/details will automatically route the matching requests and extract the variable into an attribute named customerId. [Incidentally,] there is also a standardization process for URI templates.

As Java Server Pages are too tightly bound to the Servlet API, they are not available with the Restlet API. But we provide powerful alternatives based on the most popular Java template engines: FreeMarker and now Apache Velocity.

JavaScript Object Notation is an efficient format for exchanging structured data that is often preferred to XML for intensive AJAX applications. Restlet now directly supports inputting and outputting of JSON documents.

One of our users recently developed a Restlet application to access the Amazon S3 storage service available via a REST API. We realized, however, that Amazon was using a custom authentication scheme instead of the common HTTP Basic scheme. In this release, you can directly authenticate by providing your Amazon credentials.

Louvel noted that a few additional features are expected before a final 1.0 release in December of this year.

Do you agree that REST is an ideal architectural goal to strive for in Web applications? Will a high quality Java REST API encourage the design of more RESTful applications?

Topic: Jerome Louvel on the Restlet Project Previous Topic   Next Topic Topic: Shoal Dynamic Clustering

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use