users@jersey.java.net

Re: [Jersey] Interlinking resources

From: James Strachan <james.strachan_at_gmail.com>
Date: Thu, 26 Mar 2009 13:47:07 +0000

2009/3/26 Paul Sandoz <Paul.Sandoz_at_sun.com>:
> 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).

DOH, of course :)

Maybe we need an annotation like @Link or @Uri something which we can
use on DTOs which avoids them being root resources but still allows
them to be able to have their URI created.


> 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.

Agreed. Deeply nested resources could be troublesome too :). In lieu
of figuring out a neat way to reuse the resource bean annotations for
deeply nested resources with related DTOs; maybe we can just start
with an annotation for DTOs?

-- 
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://fusesource.com/