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 15:44:14 +0200

Den 8. juli. 2008 kl. 15.12 skrev Marc Hadley:

> On Jul 8, 2008, at 2:58 PM, Jo Størset wrote:
>>
>> 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?
>>
> Being able to root the same resource class in multiple places is
> useful, e.g. a Customer resource could be available at:
>
> /customers/{id}
> /orders/{id}/customer/{id}
> /invoices/{id}/customer/{id}


But you would want the same way of instantiating a particular customer
for all these places (it's the same resource). And since the sub
resource path parameter is the same for these three cases, why not put
the @Path("{id}") on the customer object and let the framework
instantiate it, instead of duplicating the same logic under all three
parent resources?

Is it an important use case to not have the same sub resource path
annotation?

Jo