- May 06, 2009

Our vision is that the Web is becoming ubiquitous and that REST API, as the architecture style of the Web, helps you leverage all HTTP features. Restlet, our open source REST framework for API design, is already available on regular computers based on Java SE/EE, in Web browsers with our GWT edition and even in the cloud with a new Google AppEngine edition. But, we are still missing the Mobile Web!

With the commodification of smartphones started by the Palm Treo and pushed further by the Apple iPhone, more and more mobile users will have a usable access to the Web from their phone. So far, developers have been stuck with proprietary platforms for API design and were lacking the productivity and portability common in the Java world. But here comes Android!


Android is an open source mobile operating system initiated by Google but now managed by the Open Handset Alliance. This consortium includes prestigious constructors such as HTC, Motorola, Samsung or Sony Ericsson and larger carriers such as Sprint, T-Mobile or Vodaphone. Needless to say that Android has gained a lot of traction recently.

Technically speaking, Android is built on a customized Linux kernel, libraries such as WebKit for the Web browser  and an extensible Application Framework developed in the Java language but running on a special Dalvik virtual machine (see a complete overview here). All the built-in applications are written in Java and can accessed or customized via an Android API.


Preparing for an imminent launch of the Android-powered HTC Magic phone in France (also known as the “G2”), the mobile operator SFR, one of the third largest in France, has announced a contest for the best Android application. We thought it was a perfect opportunity to port the Restlet framework to another exciting environment and applied as a “Restlet+FOAF” project.

With some adjustments (see technical details), we were able to port Restlet on Android, with both the client-side and the server-side HTTP connectors! To show the potential of Restlet for API design on Android, we decided to go further and develop a simple extension to the Contacts applications that would retrieve the FOAF (Friend-Of-A-Friend) profile of your contacts, show their friends and let you add some as new local contacts. The source code of this sample application is available and documented in the Restlet User Guide.


With the help of Manning’s “Unlocking Android” book, we also discovered Android’s Intent/Service API design pattern, which is quite similar to Eclipse’s plug-ins. This is a powerful way to extend Android applications and share common features. In our case, we developed a FOAF Service that can be reused by other Android applications, without tight coupling on our code.

Finally, with the growing number of Restlet editions, we felt the need to put in place an automatic porting process to keep the code changes synchronized. This effort is underway but you can already read its specifications in our developers wiki. All those new features are available in recent Restlet snapshots. Enjoy!


  • I do agree with your way to see the future:
    * services availables “somewhere” – on a Google App Engine plateform or any other plateform.
    * Different types of clients : Android, but also RIA clients – flex, but why not javascript clients written with GWT or with JQuery?
    * Communication with REST services. Here we need Restlest. Or – why not – if you are on a php server – using some php script
    With that kind of architecture developping available services become easy. Then you just have to convert and integrate the values that you receive – this is not the smallest part in reality, but this part should be improved in the future. If you are interested, you can have an eye on our blog where we published some studies about that kind of architectures and where we related the problems that you can encounter – it’s in french (

  • Hi Gabriel,

    Yes, we are on the same page. The idea is to fully leverage REST/HTTP to decouple clients and servers which can end-up being located in various places. A key feature is content negotiation which can be leveraged to adjust representations to the capabilities of the clients (GWT, jQuery, Silverlight, Flex, etc.) on the server-side.

    Regarding the serialization of values/objects into representations (and vice versa), we are making significant progress for our next Restlet 2.0 release (due at the end of 2009). See for example the new ConverterService and the new Resource API.

    Best regards,

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

  • url to the android sample application should be the blog post refers to a 404 location.

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

  • harold

    i have a question about using Restful-Webservice with Android. For example i have a Webservice where i save all my contacts/friends. So in Rest every Friend is a Ressource. For example if i have 20 Friends, then the Client asks for the Friends and gets a List of 20 IDs, and then he must make 20 Request to get Information of every Friend. If im making a URI like “…/clientid/getallfriends” on the Serverside, from which i get directly all 20 friends in the Response, then its a anti-pattern in REST. But how can the first solution be efficient in the mobile evironment, cause the network is slow and unreliable and every request needs batterypower? In the first solution i have 1+20 Requests, in the second i have only 1 Request. I really want to understand. Thank you

    • antonyalappatt


      This has to be looked from a system perspective. For the first request there will be 20 + 1 request. But if caching is enabled, then the second request will have only 1 request as the other 20 requests would be cached locally in your mobile.

      Imagine what happens if a new contact is added then totally there would be only 1 + 1 request for the entire contact database of 21 entries.

      This is very beneficial in a mobile environment as there is a no network transport for further requests conserving battery and airtime.


  • Hi Harold,

    It not unRESTful at all. You might want to use query parameter to control the depth of your representations. Having both seem useful.

    What also seems important is to be able to access to each friend independently, if necessary.

    Best regards,

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