BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News A Comparison of JAX-RS Implementations

A Comparison of JAX-RS Implementations

This item in japanese

Bookmarks
As someone remarked elsewhere, there's a strange phenomenon regarding buses: you wait ages for one, then three come along at once! The same seems to be true for JAX-RS implementations. At the moment we have:
  • CXF - which is a merger between XFire and Celtix (an Open Source ESB, sponsored by IONA and originally hosted at ObjectWeb).
  • Jersey - the JAX-RS Reference Implementation from Sun.
  • RESTEasy - JBoss's JAX-RS project.
  • Restlet - probably the first REST framework, which existed prior to JAX-RS.
Irrespective of the various debates around REST, it cannot be argued that there is a need for REST support in the Java language and JAX-RS is it. But if you're new to REST, which one of these implementations is the one for you? Well Solomon Duskis has set out to try to shine a light on that debate. As he also points out on dzone:
I'm interested in comparing the following aspects of the JAX-RS implementations that extend beyond "pure" JAX-RS.
Which amongst others include:
  • Maturity of the product
  • Server-side Integration Strategies
  • Java Client API
  • Configurability
  • Security
  • Performance
Solomon states that "Jersey is meant as a reference implementation. RESTEasy is a playground for new ideas. CXF has an "enterprise version" supported by IONA. The Restlet project grew out of a desire to have a RESTful API alternative."

Although on the comments to the blog, Bill Burke counters:
RESTEasy is not just a playground for new ideas.   We're actually going to be supporting it within JBoss very soon (as soon as I can get my hands on the TCK!) and have a number of large customers who already use RESTEasy breathing down our necks to do so.
In terms of ease of use, Solomon has this to say so far:
The problem you face is deciding an implementation.  I found Jersey really easy to start with, although Bill [Burke] would argue that RESTEasy is just as simple.  They both are meant to work with EJB.

 Still, play around with Jersey... It shouldn't take you too long to get a HelloWorldService up and running, especially if you download NetBeans.  I used Jersey and NetBeans for the first time, and was up and running within a half an hour, and that included downloads, installations and code surfing.

Folks at Sun are keen to distance Jersey from the traditional thoughts people have about "reference implementations":
When you get to "Product Purpose", make sure you consider Jersey as a "production-ready" product (bundled in GlassFish v3 "Prelude" shipping next month as a matter of fact). The team has just spent way too much time testing and improving the code to have it be dismissed as the "reference implementation" ! :)
Solomon's plan is to research each of those aspects and post updates in subsequent blog entries. A JAX-RS Spring Integration entry has already appeared.
The four current JAX-RS implementations provide Spring integration, even JBoss's RESTEasy.
He goes on to give a fairly brief description of the integration and in the case of Jersey references old material as Paul points out. It's a shame because there is a need for an in-depth comparison. Solomon concludes that:
There are really fantastic Spring/JAX-RS capabilities through out the four implementations, but I think that CXF takes my vote for "Best Spring integration in a JAX-RS product."
But obviously this is his opinion and others disagree. For example, Bill Burke asks:
I don't see how CXF Spring integration is any better than the rest. I don't see the need/reason for all the extra CXF-specific XML within a Spring XML file. The Spring integration provided by both RESTEasy and Jersey seam less intrusive than what is required by CXF. Or am I wrong?
To which Solomon replies:
annotation driven approaches work well if there is a single configuration being used per class which is pretty much what you need 90%+ of the time. The other 10%- requires multiple configurations of the same Resource in multiple contexts. I know that I'll need that 10%- type solution based on the requirements and current deployments of the functionality that I'm updating. [...] CXF gives you the additional ability to deploy the same Resource, configured differently (different JDBC sources, different service implementations and etc) through the same spring.XML file. Basically, annotations work great most of the time, but sometimes you have to fall back to external configuration alternatives for the decoupling benefits. The XML alternatives aren't as sexy as annotations, but they work for more complex configuration cases."
Maybe something that could have been brought out in a more detailed comparison?

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

  • Broken links

    by Manish Bhatt,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    None of the links working.

  • Re: Broken links

    by Mark Little,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    Sorry about that: first use of Firefox 3 and it seems to be playing up. Anyway, all should be fine now.

  • Need a new comparison

    by William Siqueira,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    It was in 2008. RESTEasy, CXF and Jersey has changed a lot.

    Any plans for a new comparison?

  • Re: Need a new comparison

    by rag transitory,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    yeah, as william said.. can you Please share us the details of advantages & disadvantages of those various JAX RS Implementations based on their recent releases. It will be great if i get it.

  • Re: Need a new comparison

    by Sourabh Kapoor,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    can anyone please let me know the pros and cons of resteasy vs jersey.if it helps : I am new to both the framework..Have prior knowledge of XML, JSON, Tomcat and MVC FrameWorks.I have used little bit of spring but new in JBOSS and EJB.Performance is the criteria.I need it for a eCommerce website supporting html5 (possibly running for all mobile platforms) and restful apis.

  • Spring REST

    by prathap gym,

    Your message is awaiting moderation. Thank you for participating in the discussion.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT