users@jsr311.java.net

Re: Selecting between method candidates

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Wed, 21 May 2008 10:44:30 -0400

On May 21, 2008, at 10:12 AM, Beryozkin, Sergey wrote:

> Yes, I agree, I'd just like to get the confirmation that
> "Descending order of a number of capturing groups" sorting criteria is
> there
> to address this kind of scenario.
>
> So if have a 'greedy' SubResource2 locator which handles all /{var}/*
> requests, then does it mean that there's no way to ensure that some
> other subresource locators can get involved in handling /{var}/*
> requests, possibly with different HTTP methods ? It's not a specific
> issue I'm trying to sort out, but just curious
>
> Same question applies to selection of root resources. If we have a
> 'greedy'
> root resource then it will basically catch all the requests matching a
> specific pattern. So probably it only makes sense to have multiple
> root
> resources/sublocators on a given resource class for different @Paths
> only then...
>
That why the sort in bullet 1.(e) is descending order. A greedy root
resource acts as a "backstop" with more specific root resources that
match a request being sorted ahead.

Marc.

>
>> I've got another quesion though. "Descending order of a number of
>> capturing groups" in bullet 2. My understanding it's mostly there to
>> address the selection between multiple subresource locators, right ?
>> Anyway, here's a concrete question :
>>
>> Parh("/")
>> class Bar {
>> @Path("/{bar}") SubResource1 a();
>> @Path("/{bar}/{foo}") SubResource2 b();
>> }
>>
>> class SubResource1 {
>> @Path("/sub1") @GET a();
>> }
>>
>> class SubResource2 {
>> @Path("/sub2") @GET a();
>> }
>>
>> Now, if we rely on a "Descending order of a number of capturing
> groups"
>> then a request like
>>
>> /1/sub1 is matched against b().
>>
>> is it expected ? If yes then how to ensure a request is delegated
>> to a
>
>> SubResource1.a() in this case ?
>>
>
> IMO, b() would be matched always because Locator's are supposed to be
> dynamically processed/dispatched per request.
>
> Bill
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jsr311.dev.java.net
> For additional commands, e-mail: users-help_at_jsr311.dev.java.net
>
> ----------------------------
> IONA Technologies PLC (registered in Ireland)
> Registered Number: 171387
> Registered Address: The IONA Building, Shelbourne Road, Dublin 4,
> Ireland
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jsr311.dev.java.net
> For additional commands, e-mail: users-help_at_jsr311.dev.java.net
>

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.