Hello,

I noticed that the restlet jax-rs implementation has difficulties 
selecting the best resource method when multiple methods (in the same 
resource) match a given URI.

An example will clarify:

@Path("foo")
public class FooResource {

     @GET
     @Path(value = "{id}")
     public String getFooId(@PathParam(value = "id") Long id) {
         return "foo"+id;
     }

     @GET
     @Path(value = "bar")
     public String getFooBar() {
         return "foobar";
     }
}

GET foo/5    =>  "foo5"
GET foo/bar => 404 Not Found

Reason:
The algorithm finds in both cases that resource FooResource is the best 
matching resource. During this research, it even knows that getFooId is 
the best matching method in the first request, and getFooBar is the best 
in the second request.
But once the resource is chosen, another part of the algorithm looks for 
the best matching resource method, but seems to be disregarding the 
amount of literal characters and capturing groups in the matching uri 
templates.
Then both methods are considered equally good, and the first one is 
chosen in both requests, yielding the error in the latter.

This looks like a bug to me. Should I create an issue ?

wkr,
Jeroen

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2627111

Reply via email to