jump to navigation

Restlet, a RESTful middleware for GWT, GAE and Android December 17, 2009

Posted by Jerome Louvel in Android, Ecosystem, GAE, Google, GWT, Microsoft, REST, Restlet, Restlet General.
trackback

The Web is taking multiple shapes with the Mobile Web, Cloud Computing and RIA being hot topics recently. If you follow this blog frequently, you are certainly aware that the Restlet Framework, the first RESTful web framework for Java developers, is available in five consistent editions since version 2.0 M4. Each edition targets a special development environment:

  • Google Web Toolkit (GWT) for AJAX applications deployed in desktop browsers, without any plugin required
  • Google App Engine (GAE/J) for deployment on Google’s cloud computing infrastructure
  • Android for deployment on compatible smartphones
  • Java SE for standalone deployments in regular Java Virtual Machines
  • Java EE for deployment in Servlet engines

Each edition is offering the same Restlet Framework, with restrictions and adjustments based on the target environment. For example, the GWT edition only supports the client-side usage of Restlet, while the GAE edition only provides compatible extensions and ensures that we don’t break the security sandbox or use unsupported JRE classes.

As a result, you can easily develop a unified Restlet application with a server-side deployed in GAE, a client version available for Android smartphones and another available for desktop browsers with GWT, fully leveraging the most innovative technologies available from Google for Java developers.

You might wonder what exact value does Restlet brings in the middle of those technologies? The Restlet Framework is all about REST, supporting advanced HTTP features such as content negotiation, caching and conditional processing, allowing for the same URI-addressable resource to expose various representations. Each representation renders the same information in  various languages or formats such as JSON, XML or anything else that makes sense for your clients such as binary pictures.

Supporting content negotiation allows your Restlet cloud server to expose the same resources to all its clients, including an Android smartphone client, a GWT desktop client, a Flex client, a programmatic Java SE robot or a basic HTML browser. One Java API and one unified code base gets you covered in all those scenarios, even if you need to serve static files: a Restlet Application truly merges the notion of Web Site, Web App and Web Service!

So, using Restlet as a cloud server gets you much further than a regular Servlet application. Usually, you would use GWT-RPC to communicate between your GWT client and your GAE back-end, and the low-level HTTP client provided by Android to communicate with your GAE custom Servlets. Obviously, the result wouldn’t be very RESTful as GWT-RPC is introducing some strong coupling. You could use the low-level HTTP client provided by GWT as well, but then you would loose the big benefit of using Java proxies in GWT, with transparent serialization of parameters and result object.

This is where the Restlet Framework comes to rescue! For GWT, we provide both a high-level HTTP client, removing the need to manually parse and format HTTP headers thanks to its Restlet API but also a proxy generation mechanism based on GWT deferred binding very similar to GWT-RPC but truly RESTful! Migration of existing GWT-RPC code is straightforward as we also support GWT-RPC AsyncCallback interface in addition to our equivalent Result interface. For our serialization format, we reused the one of GWT-RPC, a special JSON variant, therefore it is fully featured and as robust as GWT-RPC ! In your Restlet cloud server, you just need to add our server-side GWT extension to transparently support this serialization format, thanks to content negotiation.

If you are a Google fan, you should be happily developing with the recent GWT 2.0, Android 2.0 and GAE 1.3.0 releases and the RESTful solution described above should gives you a big smile and to get started, we have written a complete tutorial, with full source code, illustrating a unified Restlet application for GAE, GWT and Android.

But even in this scenario, you wouldn’t be restricted to Google technologies, you could chose to support alternative clients such as regular HTML browsers, Flex or Silverlight clients, or any other HTTP client. On the server-side, you could take the same Restlet application and deploy it locally, or on Amazon EC2 or Microsoft Azure, thanks to our Restlet editions for Java SE and Java EE which can be installed on those major cloud platforms!

In the end, the Restlet Framework offers you, for free, the first comprehensive RESTful middleware for Google technologies and beyond! As a last word, I would like to thank again my friend Didier Girard, for sharing his insights that led us to this post (and a lot of work!) 🙂

Advertisements

Comments»

1. Tweets that mention Restlet, a RESTful middleware for GWT, GAE and Android « Noelios Technologies -- Topsy.com - December 17, 2009

[…] This post was mentioned on Twitter by Loic Descotte, Azure Magic. Azure Magic said: Restlet, a RESTful middleware for GWT, GAE and Android- The Web is taking multiple shapes with the Mobile Web, Clou… http://bit.ly/7JdJA1 […]

2. Restlet ported to GWT ! « Noelios Technologies - December 19, 2009

[…] post: Restlet, a RESTful middleware for GWT, GAE and Android Possibly related posts: (automatically generated)Restlet, a RESTful middleware for GWT, GAE and […]

3. Restlet in the cloud with Google App Engine! « Noelios Technologies - December 19, 2009

[…] post: Restlet, a RESTful middleware for GWT, GAE and Android Possibly related posts: (automatically generated)Restlet 2.0 M6 availableRestlet ported to GWT […]

4. Restlet available on Android phones « Noelios Technologies - December 19, 2009

[…] post: Restlet, a RESTful middleware for GWT, GAE and Android Possibly related posts: (automatically generated)Restlet, a RESTful middleware for GWT, GAE and […]

5. Stefan - December 20, 2009

This sounds great, can’t wait to test it.

6. Steve Sfartz - December 21, 2009

Incredible work at simplifying and automating REST in heterogeneous envs

7. Nirav Shah - December 22, 2009

Great Article, Jerome! Gives a very good view of the whole picture.
Its great to see Restlet work in so many environments.
Cant wait to read the detailed tutorial next ! 🙂

Also, many congratulations to you and the team for all the hard work.

8. Kesav Kolla - December 30, 2009

Can we access these restlet services using ASP.NET AJAX libraries? Currently ASP.NET AJAX libraries can acces ADO.NET service but can they access these restlet services?

Thierry Boileau - January 4, 2010

Hello,

Restlet allows you to develop (in Java) your set of resources exposed on the Web. Such resources are available from any Web clients.
The keys of the interoperability are REST and HTTP.

Best regards,
Thierry Boileau

9. Restlet 2.0 M7 released « Noelios Technologies - January 29, 2010

[…] GWT object serialization support, based on annotated Restlet interfaces was also added for the GWT edition, leveraging GWT’s deferred binding mechanism and GWT-RPC serialization format! See this related post for details. […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s