users@jersey.java.net

Re: [Jersey] Interlinking resources

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 26 Mar 2009 09:44:14 +0100

On Mar 25, 2009, at 7:00 PM, James Strachan wrote:
>> You can do this:
>>
>> UriBuilder.fromResource(B.class).build(idForB);
>
> Awesome! :) I'd not spotted that!
>
> That only works with resource beans right?

It works for any class annotated with @Path.


> I wonder if it'd work if we
> used @Path on a DTO rather than a Resource?
>

It should but then @Path also signifies that the annotated DTO would
be a root resource class (if registered).

I am wondering if in general we need a "link model" that can be
obtained for a resource that describes the root link and sub-resource
links, and from which URIs can be instantiated. The JAXB WADL beans
provides that, but i think something more focused might be easier to
use.

In general this area needs a lot more investigation and
experimentation. Two experiments which seem to go rather well were
using AOP to fill in the links of JAXB beans, and the integration with
Sommer (RDF framework) using a JavaBean property model where
properties correspond to templates.

Paul.