users@jsr311.java.net

Re: Matching requests to subresource methods

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Tue, 11 Mar 2008 10:21:51 -0400

On Mar 11, 2008, at 10:05 AM, Sergey Beryozkin wrote:
>
> Consider this class
>
> @Path("/")
> public class RootResource {
>
> @PATH("foo")
> public Bar getLocator() {
> }
>
> @GET
> @PATH("foo")
> public Response getState() {
> }
> }
>
> > GET /foo
>
> As per the Section 2.5.2.d, both getState() and getLocator() will be
> in the initial list of candidates.
>
> I'm not quite sute what happens next, as far as 2.5.2.f is concerned.
> I think for both methods the number of literal characters (in
> templates) and the number of capturing groups is the same, thus
> getLocator() will be chosen simply because it goes first
> alphabetically, and then Bar will be further introspected.
>
> Is it correct ?
>
I think you are right and we should set a preferred order. I think
that the getState sub-resource method should be sorted before
getLocator since Bar might not support GET so you should take the
match you have rather than ignore it in hope of finding anther match
later. Anyone disagree ?

Marc.

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