users@jersey.java.net

Re: [Jersey] Reverse Lookup

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 28 May 2010 17:29:35 +0200

Hi Vedran,

There is an open issue for this and i know others need this
functionality:

   https://jersey.dev.java.net/issues/show_bug.cgi?id=536

I need to think more on how such pseudo-internal requests should work
as such requests will be different to that of requests originating
from the client. For example should such pseudo requests re-use all
the headers of the original request, or just a meaningful subset (e.g.
Authenticate?)

However, apart from such details i think it should be fairly easier to
adapt the current matching functionality.

Paul.

On May 28, 2010, at 12:55 PM, Lerenc, Vedran wrote:

> Hi,
>
> I am new to Jersey and try to generically use it in combination with
> Hibernate and XStream. When I send an resource object over the wire
> I use XStream for serialization and when this resource object
> contains references to other resource objects, I replace them with
> the resource URI instead of serializing them. This works quite good
> with the help of the UriBuilder (e.g.
> UriBuilder.fromResource(type).path(type,
> "getById").build(id).toString()).
>
> However – and that’s my question – how can I get the resource class
> back from the URI (e.g. /cars/123). Jersey does it once for the
> containing resource when the REST call hits it, but then I am on my
> own while deserializing the content. I must take an URI that I have
> built with the help of the UriBuilder and get the original resource
> class back. Does anybody know how to do this lookup from URI to
> resource class?
>
> Thanks in advance,
>
> Vedran
>