users@jsr311.java.net

Re: sub resource locators & generating urls

From: Jo Størset <jo.storset_at_usit.uio.no>
Date: Tue, 8 Jul 2008 14:58:11 +0200

Den 8. juli. 2008 kl. 14.18 skrev Stephan Koops:

> Hi Jo,
>> Another suggestion - what if the sub resource locator returns a
>> class? Then the sub resource locator only specifies the resource to
>> use, leaving the instantiation to the container?
> This was also discussed :-)
> A non-root resource class instance typically gets something from the
> path, e.g. an id. IMO the sub resource class should have no
> references to previous path segments, which is needed in this case.
> With the current construction the sub resource locator mathes the id
> and gives it to the sub resource class instance, but the sub
> resource class instance do not need to now, where it is read from.

Isn't this kind of mixing two architectural models? Either the jax-rs
resources should be a separate layer on top of a service/dao/whatever
layer, mapping web<->domain, or the resources should be the domain
objects themselves?

Since this last model is kind of awkward to realize when the jax-rs
container is to instantiate root resources, wouldn't it be better to
optimize for the separate resource layer?

Anyway, I think I would prefer a model where the sub resource itself
knew the information it needed (the path annotation was done on the
sub resource rather than on the locator).

Is it an important use case for being able to switch the sub resource
identifier resolving at different places in an app? If so, couldn't it
just be done explicitly when needed?

Sorry if this is revisiting all the stuff you guys allready have been
through. It's not all clear to me how the spec is supposed to be used,
and I guess it's better with feedback now rather than after it's
finalized. (It is kind of quiet on this list?)

Jo