Jersey 0.6 is released

Jersey

We have just released version 0.6 of Jersey (see the stable download directory). This aligns with the 0.6 release of the JAX-RS API and the latest editors draft.

This version will be available soon from the Glassfish Update Centre and as part of the NetBeans RESTful Web service plugin from the NetBeans Beta Update Centre.

We managed to achieve most things we highlighted in the schedule (more on the missing bits later).

Jakub added improved JSON un/marshaling to JAXB so one can produce JSON from JAXB beans that is much easier to consume by applications like jMaki (see the jMakiBackend example in the Jersey distribution). (I wonder if it is applicable to applications like GWT ?).

We improved on the work Marc did integrating Jersey with IoC containers, like Spring or Guice. Most developer-based things in Jersey are now components that defer to a "component provider" for instantiation and injection. This enables the life-cycle of resource classes to be independent of the IoC container. A developer on the Jersey users list has already experimented with Guice. There are some friction points that still need to be resolved: the main one being constructors where the IoC framework chooses the constructor but only knows about some constructor parameters and Jersey knows about others (especially request-based parameters like those from the request URI).

It is now very easy to register implementations of MessageBodyReader/Writer (the same underlying mechanism scanning for resource classes is reused). Marc and I show (here and here) how such readers/writers can be used with Abdera to create simple Atom-based services.

I promoted the client API used for Jersey unit testing to a public API of Jersey, see here (note that the class ResourceProxy has now been renamed to WebResource as suggested by Stefan Tilkov). This API focuses on the uniform interface constraint and i have found it very productive when writing unit tests. Some of the existing APIs focus on the lower-level request/response which as a consequence makes them more clunky to use. It also borrows from ease of use aspects of JAX-RS and the runtime, especially the message body readers/writers.

Finally i managed to put into code a very simple SPI for plugging in template processors and enabling a flexible model view controller approach. Essentially a resource class can return a template name and a model. The template name gets resolved to a template file in the class path that can be processed by a registered template processor that in turn processes the template with the given the model. I plan to blog about this in more detail later. The Bookstore example in the Jersey distribution provides an example of implicit views using JSPs. A developer on the user list has enabled Freemarker templates in a couple of lines of code and has experimental XSTL translations with JAXB beans (see this thread, which also attempts to explain the difference between implicit and explicit views).

The two areas where we did not make as much progress were adding servlet-based unit tests and evaluating a transition to using Maven.

However, recently on the users list there were requests about using Jetty with Jersey. That gave me just enough information to work things out fairly quickly so now i think we can get good unit tests in place for Jersey's servlet support and increase the code coverage percentages.

As for Maven, we just ran out of time. I believe it is likely to be a significant overhaul of the Jersey build process to transition to Maven and i have heard some Maven-hell stories that make me pause before diving in... so if there are any Maven experts out there with some free time of their hands and would like to help just drop me an email.

In terms of what's next:

  • align with 0.7 of the JAX-RS API and fill in all those missing little gaps (this may be a lot of work);
  • improve the scope of the JSON support (namely supporting XML attributes);
  • refine the MVC and template processor support to manage content types and language;
  • (if time permits) experiment with Grizzly and comet;
  • (if time permits) provide as part of the Jersey distribution component providers for Guice and Spring. This may be popular judging from the comments we have received; and
  • (if time permits) give some more Scala and Groovy TLC to Jersey; 

As usual feedback and participation are most welcome, just send email to the users list and/or log issues.

Comments:

Paul,

You recently helped me with Jersey and jetty and I appreciate your pointing me in the right direction.

The reason for me wanting to working with jetty is that maven has a nice jetty plugin which makes rapid testing easy to do. From a Jersey users point of view, I just published this writeup: http://codebeneath.blogspot.com/2008/03/jersey-jetty-and-maven-style.html

From a Jersey developer point of view, I think maven might be a good fit and I have enough experience that I might be able to help. The jetty plugin would certainly be a nice way to go to deploy services pre-integration test phase. Let me know what you're thinking along those lines.

Posted by Jeff on March 07, 2008 at 10:49 AM CET #

[Trackback] Today the Jersey community has released version 0.6....with support for Grizzly 1.7.2 and its new Request/Response API!

Posted by Jean-Francois Arcand's Blog on March 07, 2008 at 01:15 PM CET #

Hi Jeff,

Glad things worked out. Nice blog entry. Some other developers on the users list have also used Jetty in the style you have mentioned but now i know, from your explanation, how to do it myself :-)

The PackageResourceConfig approach was created in response to the Jetty users using "mvn jetty:run" for rapid-development.

BTW i still want to integrate JavaRebel (see a previous blog entry i wrote) with Jersey to get hyper-rapid-development :-)

Paul.

Posted by Paul Sandoz on March 07, 2008 at 03:02 PM CET #

[Trackback] Hi, my last post is nearly years ago (mhh, bad english?) and of course I wanted to write about this and that. But right now I had so much fun that I have to share this… Fun with… jersey, the reference implementation for the upcoming jsr311 ...

Posted by javakaffee on March 07, 2008 at 09:15 PM CET #

Hi.. u mentioned that a new plugin for netbeans will soon be released.. how soon can i expect it .. in a week or something ?

Posted by vineet on March 10, 2008 at 11:23 PM CET #

Hi Vineet,

Sorry for the delay in replying i was away on holiday last week.

I will find out about the NB schedule and get back to you.

Paul.

Posted by Paul Sandoz on March 17, 2008 at 03:53 AM CET #

The new NB plugin should already be available (https://jersey.dev.java.net/servlets/ReadMsg?list=dev&msgNo=362 )

Posted by Jakub on March 17, 2008 at 04:32 AM CET #

Hi
How do we get wadl for a resource in jersey 0.6? (The Accept: application/vnd.sun.wadl+xml method does not seem to work)

Posted by Venkatavaradan on March 24, 2008 at 03:05 AM CET #

Hi Venkatavaradan,

We removed GET support for obtaining the WADL for resources. You need to use the OPTIONS method. It is still possible to GET the application WADL from the URI: <base URI>/application.wadl.

The reason we removed it was because the GET of the WADL could interfere with application-specific HTTP methods and views, namely i could not achieve transparent and consistent WADL support using GET.

Definitely open to suggestions on this as it is still experimental.

Paul.

Posted by Paul Sandoz on March 25, 2008 at 04:06 AM CET #

hi paul.. i am developing some web services using the jax rs and am facing a strange problem.. in the service i make a jdbc connection to connect to the database located on a remote machine. for a remote located database the same code works in a java application but it doesn't in the web application. is there some detail i m missing. i have done the usual jdbc connection as i do in a simple java application ..plz help

Posted by vineet on March 25, 2008 at 07:54 AM CET #

Hi Vineet,

Could you email the Jersey users list:

mailto:users@jersey.dev.java.net

and perhaps send some more information on your application (e.g. zip up a sample Web application or send code/configs) and include errors that result (if any) ?

I and others will be able to help you better if we communicate on that list.

Thanks,
Paul.

Posted by Paul Sandoz on March 25, 2008 at 08:04 AM CET #

HI,

I am trying the simpleConsole example in Jersey 0.7.

I found out that jars are already included to build the target and so I did not change ANYTHING from the examples I download.

I have tried several examples. THe ones with just HTTP get methods(like BOOKSTORE) are working. But, if some examples are having Post/put/delete, then I am unable to post data. In fact, I dont see any form to submit data.

I am guessing it is due to the warnings that I get when I build /run the project.

THe following warnings appeared when I run SimpleCOnsole example in the Jersey.

Mar 26, 2008 12:37:06 PM com.sun.ws.rest.impl.application.ComponentProviderCache getComponent
WARNING: The provider class, class com.sun.ws.rest.impl.container.servlet.JSPTemplateProcessor, could not be instantiated
Mar 26, 2008 12:37:06 PM com.sun.ws.rest.spi.service.ServiceFinder$AbstractLazyIterator hasNext
WARNING: A dependent class, javax/mail/MessagingException, of the class com.sun.ws.rest.impl.provider.entity.MimeMultipartProvider implementing the provider interface javax.ws.rs.ext.MessageBodyReader is not found. The provider implementation is ignored.
Mar 26, 2008 12:37:06 PM com.sun.ws.rest.spi.service.ServiceFinder$AbstractLazyIterator hasNext
WARNING: A dependent class, com/sun/syndication/io/FeedException, of the class com.sun.ws.rest.impl.provider.entity.AtomFeedProvider implementing the provider interface javax.ws.rs.ext.MessageBodyReader is not found. The provider implementation is ignored.
Mar 26, 2008 12:37:06 PM com.sun.ws.rest.spi.service.ServiceFinder$AbstractLazyIterator hasNext
WARNING: A dependent class, com/sun/syndication/io/FeedException, of the class com.sun.ws.rest.impl.provider.entity.AtomEntryProvider implementing the provider interface javax.ws.rs.ext.MessageBodyReader is not found. The provider implementation is ignored.
Mar 26, 2008 12:37:06 PM com.sun.ws.rest.spi.service.ServiceFinder$AbstractLazyIterator hasNext
WARNING: A dependent class, org/codehaus/jettison/json/JSONException, of the class com.sun.ws.rest.impl.provider.entity.JSONArrayProvider implementing the provider interface javax.ws.rs.ext.MessageBodyReader is not found. The provider implementation is ignored.
Mar 26, 2008 12:37:06 PM com.sun.ws.rest.spi.service.ServiceFinder$AbstractLazyIterator hasNext
WARNING: A dependent class, org/codehaus/jettison/json/JSONException, of the class com.sun.ws.rest.impl.provider.entity.JSONObjectProvider implementing the provider interface javax.ws.rs.ext.MessageBodyReader is not found. The provider implementation is ignored.
Mar 26, 2008 12:37:06 PM com.sun.ws.rest.spi.service.ServiceFinder$AbstractLazyIterator hasNext
WARNING: A dependent class, javax/mail/MessagingException, of the class com.sun.ws.rest.impl.provider.entity.MimeMultipartProvider implementing the provider interface javax.ws.rs.ext.MessageBodyWriter is not found. The provider implementation is ignored.
Mar 26, 2008 12:37:06 PM com.sun.ws.rest.spi.service.ServiceFinder$AbstractLazyIterator hasNext
WARNING: A dependent class, com/sun/syndication/io/FeedException, of the class com.sun.ws.rest.impl.provider.entity.AtomFeedProvider implementing the provider interface javax.ws.rs.ext.MessageBodyWriter is not found. The provider implementation is ignored.
Mar 26, 2008 12:37:06 PM com.sun.ws.rest.spi.service.ServiceFinder$AbstractLazyIterator hasNext
WARNING: A dependent class, com/sun/syndication/io/FeedException, of the class com.sun.ws.rest.impl.provider.entity.AtomEntryProvider implementing the provider interface javax.ws.rs.ext.MessageBodyWriter is not found. The provider implementation is ignored.
Mar 26, 2008 12:37:06 PM com.sun.ws.rest.spi.service.ServiceFinder$AbstractLazyIterator hasNext
WARNING: A dependent class, org/codehaus/jettison/json/JSONException, of the class com.sun.ws.rest.impl.provider.entity.JSONArrayProvider implementing the provider interface javax.ws.rs.ext.MessageBodyWriter is not found. The provider implementation is ignored.
Mar 26, 2008 12:37:06 PM com.sun.ws.rest.spi.service.ServiceFinder$AbstractLazyIterator hasNext
WARNING: A dependent class, org/codehaus/jettison/json/JSONException, of the class com.sun.ws.rest.impl.provider.entity.JSONObjectProvider implementing the provider interface javax.ws.rs.ext.MessageBodyWriter is not found. The provider implementation is ignored.
Server running, visit: http://127.0.0.1:9998/resources/form, hit return to stop...

I have visited the http://127.0.0.1:9998/resources/form after running it as it has shown Server running (despite warnings). But I dont see any FORM in the browser as expected according to the README file in SIMPLECONSOLE. In fact, It keeps on waiting for localhost and nothing appears.

I am a bit new to Java, can you please help SIMPleCONsole example work for Me.
FYI: I am using Netbeans and I have the RESTFUl webservices plugin installed in my netbeans.Please feel free to find out any other information from me.

Thanks,

Jyothsna

Posted by Jyothsna on March 26, 2008 at 01:56 PM CET #

Jyothsna,

What version of the RESTful plugin are you using, what is your hardware/platform, and what JDK are you using?

I suspect the problem with the SimpleConsole example has nothing to do with HTTP methods and is something to do with the Light Weight HTTP server. I have been told of issues on Windows, but it is really hard to track the issue down.

Were you able to run the OptimisticConcurrency and StorageService examples?

The warnings are not a problem. They are just informing you what
components Jersey could not load. SimpleConsole does not depend on such components. Jersey tries to reduce the static dependencies on classes files where possible so that developer just include the jar files they need. The warnings are there to help those to include what they need if they missed something.

Paul.

Posted by Paul Sandoz on March 27, 2008 at 05:53 AM CET #

Hi Paul,

I am using JAXB beans to be able to produce JSON objects. Unfourtanetly, when I get a String containing any of escape characters (like ", \\ etc) my JSON object is not valid anylonger. Any ideas or hints ?

Thank you,
Farjola

Posted by farjola Zaloshnja on October 30, 2008 at 10:09 AM CET #

Farjola: any chance you could switch to the Jersey 1.0 version? There such characters work fine with JSON.

Posted by Jakub on October 30, 2008 at 10:33 AM CET #

Hi Farjola,

Sounds like an character escaping issue when generating the JSON.

Can you email details to:

users@jersey.dev.java.net

Please include as many details as you can, Jersey version, example code etc, so we can help you.

Thanks,
Paul.

Posted by Paul Sandoz on October 30, 2008 at 10:35 AM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
About

sandoz

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today