I've built a project with RESTlet. Recently I've begun evaluating Jersey. Jersey is close enough to what I want to continue trying it. The prior project may keep RESTlet out of inertia, but had I to choose all over again I would go with Jersey or rolling my own.
Background
Where I work I selected RESTlet when building our first Java RESTful web service. RESTlet got the job done, but I found it it to be heavyweight and suffer from NIH.
Subsequently I prepared a hands-on workshop for my local JUG where I used Jersey. This wasn't enough experience to definitively say that it's better than RESTlet. However, my first impressions of Jersey are better than they were of RESTlet.
Re-inventing Servlets
With a name like RESTlet, the project could have gone a couple ways:
- minimal servlet or servlet adapter from which to implement a RESTful service
OR
- complete replacement of the Servlet framework with a new web application framework geared around REST
The RESTlet creators believed the latter was the better choice. A consequence of this decision is that all the code inventing a new web app framework contributes to a large codebase, more dependencies, and more to understand when using RESTlet to build your service.
RESTlet does provide a Servlet. It's a bridge class that jettisons the Servlet API as quickly as possible.
Overly Deep and Java-ish API
If you think the Java Swing API is a great example of how to make a rich API then you probably disagree that this is a drawback for RESTlet. My bias is for less framework, less abstraction and less generality in a REST framework. Or at least an easier to use facade on top of your richly decomposed OO interface. Getting the value of query param called limit
should not require this much code:
request.getResourceRef().getQueryAsForm().getFirstValue("limit")
Getting the value of URI template param is more straightforward. But the code above is symptomatic of a framework that reinvents instead of augments existing web frameworks.
Practice What You Preach
A couple of the benefits of REST are simplicity when compared with other architectural styles and that REST services work with the grain of the Web. Similarly a REST framework should be simple and should build on the prior art for building web apps in Java.
RESTlet fails on both marks.
Based on initial experience, Jersey scores better on simplicity. If JAX-RS succeeds as a standard, then by definition Jersey works within the grain of Java web apps. Even without that Jersey feels a bit more natural. Annotations are a good fit.