News: Java REST Frameworks: Jersey and CXF
Per Daniel Rubio: If you've realized RESTfull web services offer a pragmatic approach to exposing business logic, but still haven't decided which framework to use for development. Matt Raible writes about his experience using Java REST frameworks, including Jersey and CXF, as well as the web services management engine Enunciate. Read Matt Raible's post 'My Experience with Java REST Frameworks (specifically Jersey and CXF)': http://raibledesigns.com/rd/entry/my_experience_with_java_rest
- Posted by: Jack Vaughan
- Posted on: November 12 2009 09:10 EST
I'm a couple of days away from deploying a Jersey based solution to production. I use JiBX to map my objects to and from XML. It's super easy to do this. My only issues with Jersey/JAX-RS were with some cases of error handling. For example, if you have a parameter defined as an int or integer in the method and the client provides a value that cannot be converted to int, I haven't found an easy way to provide a friendly error message (you can make all your parameters string to mitigate this.) Likewise, if the client goofs up the url such that Jersey can't figure out where the request should go, it returns a horrible "right-hand-rule" exception message. For example, if you specify your path with a '/' on the end and the client omits it, they get a message. A number of times, I was told my service was down because of this error message. One problem that had was that when I ran this in a local Jetty server, Jersey was able to bootstrap all the providers and services just fine but on WAS, it wouldn't look inside the jars for providers. This isn't that big of a deal but I would have liked to know how things needed to be packaged ahead of time so I didn't have to figure it out at the most inconvenient moment possible.
*shameless plug* RESTEasy is also a very popular JAX-RS implementation with a strong community and many well known companies using it in production. We have a nice client proxy framework, loads of different format support, client and server side caching options, and async HTTP abstractions, interceptors, decorators, Guice, Spring, and EJB integration. There's also an O'Reilly Book, RESTFul Java with JAX-RS, by me, that uses RESTEasy for all its examples. (Although the examples will probably port very easily to other implementations). Also, I know Restlet has a JAX-RS implementation too. Thats another one you might want to check out. -- Bill Burke JBoss, a division of Red Hat http://jboss.org/resteasy http://bill.burkecentral.com
*shameless plug*+1 for RESTEasy, I have just been evaluating REST frameworks and while there is a tonne of overlap due obviously to the JCP, I found RESTEasy to be the most logical to set up and use and it works great, and most importantly (for me at least) it works great as a standalone library outside of JBoss. It is brilliant to implement JSON or FIS with just an additional maven dep and an annotation. Performance seems very good too. So for what it is worth, great work Bill and team :o)
RESTEasy is also a very popular JAX-RS implementation with a strong community and many well known companies using it in production.