views:

1834

answers:

4

I'm looking for a best way that is available for Java developers to implement REST services that will be communicating via JSON or XML. I'm looking for production-ready products.

I know that Spring 3.0 is coming, but it's not done yet - no luck.

Is Jersey the one?

My application is hosted by Tomcat, uses Spring, Jettison and XStream.

I'd like to use an open-source package that will allow me so have a similar development experience as WCF.NET, where I can declare the Url templates, map GET/POST and get an output either in XML or JSON. The accepted payload should be XML or JSON as well.

Any ideas out there?

+3  A: 

Jersey, RESTEasy, and Restlet all claim to do what you're asking. I've only tried Restlet, and I thought it was pretty nasty.

Spring 3 hasn't reached final release yet, but the M2 build seems to be pretty solid, and has the REST stuff there. If I were building a new REST webapp, I'd probably take the risk with M2.

skaffman
What do you think is the time frame for the release of Spring 3.0?
IgorM
M3 was due out last month, but hasn't appeared yet. RC1 is due in June, I think, so hopefully final release of 3.0 will be Q3 this year.
skaffman
A: 

Yes, Jersey is rather good and based on your description would do exactly what you want.

I wouldn't wait for Spring-WS-thing -- Jersey is good, and I don't know what benefits there are to Spring alternative, beyond "Spring brand". To me JAX-RS (that jersey implements) is a very good example of choosing and using best components that implement open APIs; Jersey runs on (amongst other things) any servlet container, can use best XML/JSON/etc parsers, use pluggable validation (bean validation api) and so forth. Same should be true for other JAX-RS implementations too (like Resteasy).

StaxMan
A: 

I've used and committed some patches to CXF. It supports JAX-RS and is fully configurable with spring. There's a good tutorial here:

http://cwiki.apache.org/CXF20DOC/jax-rs.html

CXF is an apache project and as JAX-RS is a standard you should have no problems moving away from it if you have any difficulties.

Hope this helps.

Pablojim
+1  A: 

Hi, I tried with Restlet, RestEasy, Jersey, CXF, Spring. Here are my feedbacks:

  1. Restlet: Kind of nasty with its own set of Annotations. And little confusing as well. Cant blame much though, as they stared implementing this even before JAX-RS was there.

  2. RestEasy / Jersey / CXF : As easy as its name is. Simple and straight forward to start working on it. Good part for these 3 framework is that, as they are compliant with JAX-RS, anytime in future can quickly fall back to so other JAX-RS compliant framework if its performing better or suiting your needs even better

  3. Spring: Spring 3 have started supporting REST APIs. But make a not that it is NOT JAX-RS compliant, for the very reason as that for Restlet.

    So I would choose only from RestEasy / Jersey / CXF.

Yagnesh Chawda