InfoQ

InfoQ

News

My Bookmarks

Login or Register to enable bookmarks for unlimited time.

The content has been bookmarked!

There was an error bookmarking this content! Please retry.

A Comparison of JAX-RS Implementations

Posted by Mark Little on Oct 01, 2008

Sections
Architecture & Design,
Enterprise Architecture
Topics
SOA ,
REST
Tags
XFire ,
JSR 311
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?
  • This article is part of a featured topic series on SOA
Broken links by Manish Bhatt Posted
Re: Broken links by Mark Little Posted
Need a new comparison by William Siqueira Posted
Re: Need a new comparison by rag transitory Posted
  1. Back to top

    Broken links

    by Manish Bhatt

    None of the links working.

  2. Back to top

    Re: Broken links

    by Mark Little

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

  3. Back to top

    Need a new comparison

    by William Siqueira

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

    Any plans for a new comparison?

  4. Back to top

    Re: Need a new comparison

    by rag transitory

    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.

Educational Content

New-age Transactional Systems - Not Your Grandpa's OLTP

John Hugg discusses high volume transaction processing applications with high and low frequency profiles, and how VoltDB can be used for that purpose.

Cool Code

Kevlin Henney examines code samples to see what can be learned from them starting from the premise that one won’t write great code unless he knows how to read it.

Collaboration: At the Extremities of Extreme

Jason Ayers share the observations he made watching a team of developers collaborating in real time on the same code base, pushing XP, pair programming and continuous integration to their extremes.

Yesod Web Framework

Michael Snoyman presents Yesod, a web framework written in Haskell and containing a web server, templating, ORM, libraries (templating, gravatar, etc.).

Transactions without Transactions

Richard Kreuter and Kyle Banker on how to avoid classical RDBMS transactional systems by using compensation mechanisms, transactional messaging or transactional procedures.

Attila Szegedi on JVM and GC Performance Tuning at Twitter

Attila Szegedi talks about performance tuning Java and Scala programs at Twitter: how to approach GC problems, the importance of asynchronous I/O, when to use MySQL/Cassandra/Redis, and much more.

10 tips on how to prevent business value risk

One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.

Interview: Software Systems Architecture: Working With Stakeholders Using Viewpoints and Perspectives

InfoQ spoke to the authors of Software Systems Architecture on a couple of new topics, the System Context viewpoint and Agile, which have been added to the second edition.