6

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?

IgorM
  • 1,068
  • 2
  • 18
  • 29

4 Answers4

3

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
  • 398,947
  • 96
  • 818
  • 769
  • What do you think is the time frame for the release of Spring 3.0? – IgorM Apr 20 '09 at 02:49
  • 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 Apr 20 '09 at 08:53
2

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.

Community
  • 1
  • 1
0

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
  • 113,358
  • 34
  • 211
  • 239
0

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
  • 8,542
  • 8
  • 45
  • 69