users@jersey.java.net

Re: [Jersey] Reverse Lookup

From: Moises Lejter <moilejter_at_gmail.com>
Date: Fri, 28 May 2010 09:38:35 -0500

I believe that you would just take the embedded URI and just issue it
as a follow-up RESTful request ...

Moises

Sent from my iPhone

On May 28, 2010, at 5:55 AM, "Lerenc, Vedran" <vedran.lerenc_at_sap.com>
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 th
> e containing resource when the REST call hits it, but then I am on m
> y own while deserializing the content. I must take an URI that I hav
> e built with the help of the UriBuilder and get the original resourc
> e class back. Does anybody know how to do this lookup from URI to re
> source class?
>
> Thanks in advance,
>
> Vedran
>