users@jersey.java.net

Re: resource relations

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 14 Jan 2008 17:11:36 +0100

Hi Tom,

Tom Deckers (tdeckers) wrote:
> All,
>
>
>
> From the examples I’ve seen, href looks like an elegant (standard?) way
> of referencing between resources. However, does the implementation
> include facilities to generate href links based on object trees?
>

Unfortunately not.


> E.g. I rely on JAXB to translate my objects to XML and back. I’d like
> the tree to be translated to the root element with a href to child
> resources, rather than translate the entire tree. Any suggestions on
> how best to deal with this?
>

There is nothing that i know of "out of the box" to help you do this
with JAXB, or for that matter any other XML-based Java API.

The NetBeans RESTful Web services plugin generates JAXB beans that
nicely handles links (that are mapped to ID fields of entity beans). You
could look at that generated code for tips/tricks.

I think this is an area we need to look more closely at as the
"connectedness" property is probably the one area where there is least
support, but i suspect is rather hard to get right with a good balance
of flexibility without being too imposing (and i suspect tooling could
play a really helpful modeling role). Currently we only have easy ways
to safely build URIs.

There might be a way to consider the JAXB tree a model and to have a
template engine approach, but we need to make some serious refactoring
work in the 0.6 version before we can experiment with that approach.

Paul.

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109