users@jersey.java.net

Re: [Jersey] Interlinking resources

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Wed, 25 Mar 2009 09:18:57 -0500

On Mar 25, 2009, at 6:15 AM, Imran M Yousuf wrote:
>
> I have a generic REST question and am wondering how to achieve it in
> using JAX-RS and Jersey.
>
> I would take an example to illustrate the scenario. There is a obejct
> 'A' which is a resource and there is 'B' which is also a resource Now
> 'A' has one or more 'B'. Now when resource 'A' is accessed it will
> 'have' 'B' as well, in terms of REST we would want them to referred to
> using their respective URIs. Now my question is if I am using
> JAXB/JSON for exporting my resources how can I achieve this?
>
You can build URIs that refer to specific instances of resources using
the methods of UriInfo and UriBuilder. E.g. when building the JAXB
bean for A you can create links to the associated Bs and add them as
values of properties of A.

Not sure if I answered your question or not ?

Marc.