users@jsr311.java.net

Re: Selecting between method candidates

From: Sergey Beryozkin <sergey.beryozkin_at_iona.com>
Date: Fri, 9 May 2008 15:02:46 +0100

Hi

I've read the latest spec and I did a bit of testing with CXF with regard to this specific scenario...
I'd like to start again and explain how I see the algorithm working...
Here's the sample class :

@Path("/{a}")
public class FooClass {

 @GET
 @Path("/")
 public Bars listBars() {...}

 @GET
 @PATH("/{e}")
 public Bar readBar() {...}
}

I've just added the @Path("/") to the listBars(). Lets assume that both methods support the same set of Produce/Consume mime types.

Request is : GET /1/

So we start from 3.7.1, selecting a resource class. When '/1/' is matched against a reg expression produced from @Path("/{a}"), the match is ok and the final matching group is '/'.

Next we move to 3.7.2.a which says that if U is either null (which would be the case if we has '/1' request) or '/' as in our case, we move on to 3.7.3.

This is a bit confusing to me as we haven't even done yet any match against resource methods of FooClass - shouldn't that be done at least once ?

In CXF, the 'at least' once match is actually done, seems like it does not break the algorithm, but I'm not sure. So during this match '/' is successfully matched against both listBars and readBars due with the help from corresponding reg expressions.

Here I'd like to ask : am I correct in assuming that the 'at least once' run through 3.7.2 should be attempted in this case ?

If yes, then it seems to me that the only criterias for choosing between listBars and readBar are those specified in 3.7.2.f and they all actually seem equal to me (source is the same - both are resource methods, numebr of capturing groups is the same - none, except perhaps for a number of literals after substitution is also the same - 1 for readBar, 0 for - listBar)

Is it correct or not ?

If not then all the selection needs to be done in 3.7.f.3 and I can not see there how listBar should be selected instead of readBar.

Can you please help to clarify it all for me ?


> Some example would be appreciated.

Literal characters means those not part of path parameters. So, e.g.
if the URI template is "foo.{ext}" then the literal characters are
"foo.". Is that clearer ?

Thanks, it is...

> Marc.

Cheers, Sergey

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