Restlet ported to GWT ! July 25, 2008Posted by Jerome Louvel in GWT, Restlet General, User interface.
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.
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.
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!
- Carl Scott -RESTful Client-Side tools for GWT
- Reworded to match the latest terminology changes (Restlet edition for GWT instead of Restlet-GWT module)
- Updated links to point to Restlet 2.0 version
- New post: Restlet, a RESTful middleware for GWT, GAE and Android
Community Restlet tutorials July 24, 2008Posted by Jerome Louvel in Restlet General.
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
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:
- Part 1 – Up and running (followed by a discussion on Restlet and Grails)
- Part 2 – Resources
- Java Quick Tip – Restlet & Spring (by Doug Burns)
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
- Philippe Van Nuijs – Restlet Resources and JSON
- Tim Peierls – Resource dependency injection in Restlet with Guice
- Sanjay Acharya – Restlet, Spring and Maven
- TMT K.K.- Restlet, JSON & Google Visualization API
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