- July 25, 2008

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 API design. It gives a feeling of transparent distribution but actually introduces tight coupling between client and server code and prevents you from leveraging existing RESTful backends. 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 web 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 design 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 API 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!


  • Pingback: Pathfinder Development » Restlet Ported to GWT()

  • Pingback: Weekly GWT Links For 8/2/08 | GWT Site()

  • Wish they had focussed on Flex instead for desktop!

  • For better REST support in Flex, you can check out this library:

    The port for GWT was just easier for us because it is mostly the same Java syntax. A port to Flex would be valuable as well we would require much more time to develop and maintain.

  • Eduard Escrihuela

    can you show examples ?

    It is impossible for me to do anything without examples!


  • Eduard, we don’t have more documentation than our wiki page for now:

    In term of Restlet API usage, you could check the general tutorial to see how to make Restlet HTTP requests:

    We’ll try to improve the documentation for the final Restlet 1.1 release.

  • Eduard Escrihuela

    Thanks Jerome,
    I am hoping anxiously your documentation!


  • Pingback: Restlet 1.1 M5 released « Noelios Technologies()

  • Nitin Gupta

    I just tried the GWT-Restlet API with the GWT 1.5 RC1. It worked wonderfully in the hosted mode. I then attempted web mode. However, When I compiled the code using the default GWT project compiler, i got the errors. Error snippet:
    [ERROR] : Class.createForEnum(“”,”Dimension”>

    Am I missing on something. Please help me as I am in the middle of a migration project and need the REST client for GWT badly.

  • Hi Nitin,

    We have also noticed this issue and fixed it in the latest Restlet 1.1 M5 release which is compatible with GWT 1.5 RC2 (it might work with 1.5 RC1 as well, but we didn’t test it).

    Best regards,

  • Nitin Gupta

    Hi Jerome,

    Thanks for replying back. I tried with RC-2 the Restlet code which I downloaded from the link on your website. I am still getting error, though now it is different. Here is a brief snippet. I just want to check with you that I am not missing anything.
    [ERROR] at final class Client extends Connector

    Can I ask you about the tentative release date of Restlet v 1.1?

    Best Regards,
    Nitin Gupta

  • Hi Nitin,

    Thanks for testing the latest release. I’ve entered a bug report for the new issue that you encounter:

    Would you mind attaching a sample source code that reproduces the issue or adding it in a comment to the issue?

    Regarding Restlet 1.1 release, the roadmap is here:


  • Nitin Gupta

    Hi Jerome,

    Here is the basic code which I wrote and called it on click of a button;

    CallbackExtension callback = new CallbackExtension();
    Client client = new Client(Protocol.HTTP);
    Reference ref = new Reference(Protocol.HTTP, “localhost”, 8080);
    client.get(ref, callback);

    CallbackExtension is a simple extension to the CallBack class.

    It works fine in the hosted mode, however compiler complains when attempt is made for the hosted mode.

    Let me know if you would like me to post the error message as well.
    Best Regards,
    Nitin Gupta

  • Hi Nitin,

    Thanks for the report. It was due to some volatile modifiers rejected by the GWT compiler. There were all removed from source code. This has been fixed in SVN trunk. You’ll be able to test again from the next 1.1 snapshot.


  • Gabor Dolla

    I can also see this problem with GWT compile when I tried GWT and restlet. My other question is: in restlet examples ( HTTP authentication is handled with
    ChallengeScheme scheme = ChallengeScheme.HTTP_BASIC;
    ChallengeResponse authentication = new ChallengeResponse(scheme,
    “scott”, “tiger”);

    Is it not available with restlet-gwt ??


  • Hi Gabor,

    Right this isn’t available yet, mainly due to the apparent lack of a base64 implementation in GWT.

    The is definitely an enhancement that we’d like to add in the future, see note at the end of:

    We have already found a public domain base64 implementation that we could leverage to support HTTP Basic authentication more quickly.

    Best regards,

  • Nitin

    Hi Jerome,

    Thanks for the update. I shall check an do some more testing.

    If there can be a quick work around for the Basic HTTP authentication, then please let me know.

    Warm Regards,

  • Pingback: radioAe6rt » GWT-Restlet snippet()

  • Hi Nitin,

    I have just added support for preemptive authentication to our Restlet-GWT module. It will make it into the next Restlet 1.1 release.

    Here is how you should use it:

    final Client client = new Client(Protocol.HTTP);
    Request request = new Request(Method.GET,
    request.setChallengeResponse(new ChallengeResponse(
    ChallengeScheme.HTTP_BASIC, “scott”, “tiger”

    client.handle(request, new Callback() {
    public void onEvent(Request request, Response response) {

    Best regards,

  • Pingback: Le blog de Fabien DUMINY » Paris JUG – conférence sur GWT()

  • Pingback: Cartoon presents Restlet « Noelios Technologies()

  • jmusgrove

    Newbie here… When I try to download the Restlet GWT — Simple Example it doesn’t download correctly, anythoughts? or references to other good examples?


  • Hi,

    We have had stability issues with our wiki recently. We have just restarted it and the link works again.

    Best regards,

  • It seems the link ( is broken again. It allows about 42k of the file to download and then closes the connection.


  • Hi Scott,

    We still have a stability issue with the wiki server. We are planning to upgrade it in the near future.

    Anyway, we have restarted it again. The link should work again.

    Best regards,

  • Pingback: The LinkedIn Blog » Blog Archive OSCON 2008 and Web Frameworks of the Future «()

  • Pingback: Restlet in the cloud with Google App Engine ! « Noelios Technologies()

  • Thomas

    Hi all,
    Is a gwt 1.6 support is planned ?

  • Hi Thomas,

    Yes, we will update our Restlet/GWT edition for GWT 1.6 before releasing Restlet 1.2 RC1 based on our main code branch at that time.

    Best regards,

  • Rogério Liesenfeld

    You claim that in GWT “the back-end has to be built using a Servlet container in order to work properly and to invoke your custom classes and methods”… but in reality it would only be a matter of porting the GWT server side classes in order to make it work with another platform, such as C#/ASP.NET. Although the official GWT documentation only talks about a Java back-end, there really should be no major technical difficulties involved in supporting other platforms (I have achieved some tricky things with GWT RPC on the server side, such as getting GWT 1.3 and 1.5 to work at the same time, and having a unique central servlet for any number of RemoteService interfaces, so I should know if there were any – unless I am missing something).

  • Hi Rogério,

    I agree that the server-side could be re-implemented in other languages. There is an example of that for PHP:

    It seems to me that reimplementing the GWT-RPC object encoding protocol isn’t trivial at all, especially if you consider having it work both ways. You have to take care of serialization policies for example which isn’t trivial.

    Anyway, REST provides a much reusable back-end, not tighted to GWT or any specific language.

    BTW, we are working in Restlet 1.2 on the support of the GWT-RPC encoding for our resource representations, as an alternative to more interoperable format like pure JSON or XML.

    The idea is to leverage HTTP content negotiation to provide the best of both worlds with the exact same server code, returning serializable Java beans as representations.

    Best regards,

  • Pingback: Restlet available on Android phones « Noelios Technologies()

  • Pingback: Restlet 2.0 M3 released « Noelios Technologies()

  • Wish

    I am using gwt-restlet to access a JAX-RS hosted webservice on the localhost. In hosted mode for GWT, I get this on error console with eclipse:
    Starting the HTTP client
    Error while handling an HTTP client call

    I am using Eclipse 3.4 and GWT 1.6. Downloaded the restlet 2.0m3 zip to get access to gwt-restlet. I have an http monitor running on the glassfish server, I does not even get the request from the GWT application. Here is the client access code:


    If I use curl to access the webservice it works fine:
    curl -v -H “Accept: application/json” http://localhost/entApp-war/resources/Items/id/70
    I see request with the http event monitor in glassfish.

    Any help is appreciated..


  • Pingback: Restlet 2.0 M4 released « Noelios Technologies()

  • Pingback: Restlet, a RESTful middleware for GWT, GAE and Android « Noelios Technologies()

  • Pingback: Fast Web UI design by Google Web Toolkit « When IE meets SE…()

  • Pingback: GWT-Restlet snippet « radioAe6rt()

  • vasu

    r.get() getting null how to solve this problem

    my code is
    ClientResource r = new ClientResource(“”);

    r.setOnResponse(new Uniform() {


    public void handle(Request request, Response response) {

    // TODO Auto-generated method stub
    try {

    } catch (IOException e) {
    // TODO Auto-generated catch block