jump to navigation

Restlet ported to GWT ! July 25, 2008

Posted by Jerome Louvel in GWT, Restlet General, User interface.
40 comments

Google Web Toolkit is a very successful technology that brings Java right inside Web browsers. It could be compared to traditional Applets but without requiring any extra plugin and with a more natural integration with the browser artifacts.

How is it possible? Well, they built a smart Java compiler that produces highly optimized JavaScript ‘bytecode’. What is great is that you can leverage your Java experience and the strong typing of the language. What is even better is that in GWT version 1.5, they added support for the generic types, the famous feature introduced in Java SE 5.

Now, how can you leverage REST in GWT? By default, they propose an opaque GWT-RPC mechanism that is closer to SOAP than to REST. It gives a feeling of transparent distribution but actually introduces tight coupling between client and server code and prevents you from leveraging existing RESTful back-ends. There is an HTTP request builder class that you can use, but it requires knowledge of lower HTTP levels like the exact headers syntax.

Wouldn’t it be nice to use the Restlet API instead, which provides a higher level mapping of HTTP semantics to a clean Java API ? Thanks to the support for generics added in GWT 1.5, we were able to achieve this port with reduced efforts and limited troubles. We had to get rid of the server-side features that don’t make sense in a browser, and of the APIs like NIO and logging that aren’t emulated by GWT. The major impact was the adaptation of the API to the asynchronous communication imposed by AJAX and GWT.

Restlet

The port, named “Restlet edition for GWT”, is available since Restlet 1.1 and its usage is documented in our Wiki. There is a discussion comparing the GWT-RPC and Restlet edition for GWT architectures and much more! The testing, most of the documentation as well as the back-end integration (see the server-side GWT extension) was contributed by Rob Heittman. I would like to thank him as well for the numerous design discussions while working on this port.

Rob Heittman is Chief Technology Officer at Solertium.  Using prototypes of the Restlet edition for GWT, Solertium has been building large enterprise applications with Restlet and GWT for the past year, for worldwide customers like IUCN and Conservation International.  “I love GWT, but I prefer RESTful web services to RPC,” says Rob.  “GWT backed by Restlet has been great for us. Now, GWT 1.5 and the new Restlet edition for GWT will make our client-side code as simple and elegant as our server code.”

Finally, if you want to follow the latest news about GWT, I recommend the onGWT blog. It is maintained by Didier Girard, a good friend who introduced me to the joys of GWT!

Updates:

Community Restlet tutorials July 24, 2008

Posted by Jerome Louvel in Restlet General.
4 comments

One remark that comes back often is the need for more documentation on using the Restlet framework. At the project level we have recently added “Quick Start” pages to the Web site:

We also have several efforts going on:

  • Restlet Wiki to produce a reference manual (still many empty pages)
  • Restlet Book to be published both as Web pages, PDF and Paperback

In addition, you have the community support, especially the mailing list archives and also Restlet’s professional support.

But that’s clearly not enough for now. However, great efforts from various Restlet users have been done,  producing valuable additional documentation.

IBM developerWorks has just published a cool 27 pages tutorial written by Andrew Glover from Stelligent. It is titled “Build a RESTful Web service, An introduction to REST and the Restlet framework”. Check it out!

Avi Flax from arc90, a consulting company based in New York, has started an enthusiastic series of blog posts titled “Building RESTful Web Apps with Groovy and Restlet”. It is an interested read, actually a detailled tutorial, even if you are not particularly interested in Groovy:

That’s a lot of nice resources to explore and a perfect opportunity to thanks all Restlet users and contributors for all their efforts. That keeps us focused on moving the Restlet project forward!

Update 1: Here are other interesting tutorials

Update 2: Recipes from Naviquan were removed as they are no longer available

Update 3: A complete list of Restlet tutorials is maintained on this wiki page

Follow

Get every new post delivered to your Inbox.

Join 62 other followers