users@jsr311.java.net

Re: Selecting between method candidates

From: Sergey Beryozkin <sergey.beryozkin_at_iona.com>
Date: Wed, 7 May 2008 13:19:31 +0100

Hi,


> Sorry for the slow reply, Paul and I are at JavaOne this week.

No problems, thanks for finding the time to reply...

>
> On May 6, 2008, at 10:37 AM, Sergey Beryozkin wrote:
>>
>> I have one question with respect to selecting between multiple
>> methods ...
>>
>> Consider this class :
>>
>> @Path("{a}/{b}/{c}/d")
>
> I assume there should be {} around d above.

No, there's no {} around d there. I think it's a valid URI Template expression ?

>
>> public class FooClass {
>>
>> @GET
>> public Bars listBars() {
>> return bars;
>> }
>>
>> @GET
>> @PATH("/{e}")
>> public Bar readBar() {
>> return bar;
>> }
>> }
>>
>> In CXF a request like URI /1/2/3/4 is delegated to readBar() but the
>> user is expecting listBars be invoked and I'm wondering, where
>> exacly CXF fails to follow the spec...
>> Both methods match the request and both methods are added to the list.
>>
> listBars would match since there's no trailing '/' on the request URI.
> readBar would only match if you used /1/2/3/4/ or /1/2/3/4/something.


I'm sorry, I think may be I don't understand well this algorithm. So I'd like to ask for some more clartifications until I do understand it well...

Here's what I can see in the spec :

Section 3.2.6/2.a : If U is null or '/' go to step

So, if /1/2/3/4/ is used then U is '/' after the root class has been selected (or null if /1/2/3/4 is used) and hence listBar() should be selected in 3.2.6/3 ?

Should readBar be selected only when /1/2/3/4/something is used ?


Here's another question.
Section 3.2.6/2.f : Sort E using the number of literal characters in each member as the primary key...

What exactly is *the number of literal characters* ? There's a footnote for 3.2.6/1e :
2Here, literal characters means those not resulting from template variable substitution.

Does the same footnote applies to 3.2.6/2.f ?

Some example would be appreciated.

Thanks, Sergey

>
> Section 3.7 describes the algorithm used to match requests to resource
> classes and methods.
>
> Marc.

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland