users@jersey.java.net

Possible Regressions in Jersey 0.6ea ?

From: James Weir <James.Weir_at_Sun.COM>
Date: Tue, 11 Mar 2008 23:13:39 +0100

Hi,

Recently migrated from Jersey 0.5 to Jersey 0.6. I think there are 2
possible bugs:

Using the client API, when retrieving the URI from the response, the URI
seems to be incorrect.

On the server side:

.....
logger.debug("===> setting location to: "+newUser.getUri());
Response r =
Response.created(newUser.getUri()).entity(newUser).contentLocation(newUser.getUri()).lastModified(newUser.getLastModified()).tag(et).build();
return(r);


On the client side:
Cache.add(response.getLocation(),t,response.getLastModified().toString(),response.getEntityTag().getValue());

Printing out newUser.getUri() on the server side and
response.getLocation() on the client side I get:

Server side:
23:01:56,642 DEBUG [Thread-3] (UsersResource.java:UsersResource:175) -
===> setting location to: users/jim


Client Side:
23:01:55,705 DEBUG [Thread-4] (CacheFilter.java:CacheFilter:36) -
CacheFilter.handle(http://127.0.0.1:9998/users)
23:01:56,642 DEBUG [Thread-4] (CacheFilter.java:CacheFilter:61) -
CacheFilter response status....: 201
23:01:56,642 INFO [Thread-4] (CacheResponse.java:CacheResponse:81) -
HTTP Status : 201
23:01:56,642 INFO [Thread-4] (CacheResponse.java:CacheResponse:82) -
Last modified time: Tue Mar 11 23:01:56 CET 2008
23:01:56,642 INFO [Thread-4] (CacheResponse.java:CacheResponse:84) -
Etag : "0e6e9708ae71b22a5de17fd26b71b044"
23:01:56,689 DEBUG [Thread-4] (Cache.java:Cache:123) - Updating entry to
the cache with key: /users/users/jim
23:01:56,689 WARN [Thread-4] (Cache.java:Cache:131) - Entry with key:
/users/users/jim added to cache


as you can see the location is now: /users/users/jim
and not: /users/jim

The second bug seems to be if you do:

throw new WebApplicationException(409)

the return code on the client side is 500

I'll log bugs for these, but I still need to write a simple example
showing these (it could be my code, unfortunately is quite late here
now, so will do this tomorrow), in the meantime has anyone else seen this.

Thanks
James