On Jan 2, 2011, at 6:56 PM, Cheng Zhang wrote:
> Hi,
>
> If I have a resource class defined as below,
>
> @Path("/category")
> public class Resource {
> @GET
> @Path("/{page: .+}")
> public Response catchAny(@PathParam("page") String page) throws
> IOException {
> ......
> }
>
> @GET
> @Path("{categoryId}")
> public Response getCategory(@PathParam("categoryId")) {
> ......
> }
> }
>
> On the client side, if the path is "/category/12", which server side
> method will be called?
>
"catchAny"
@Path("/{page: .+}") -> /(.+)
@Path("{categoryId}") -> ([^/]+?)
The order is specified as follows:
- the number of literal characters in each member as the primary key
(descending order),
- the number of capturing groups as a secondary key (descending order),
- the number of capturing groups with non-default regular expressions
(i.e. not ‘([/]+?)’) as the tertiary key (descending order); and
- the source of each member as quaternary key sorting those derived
from sub-resource method ahead of those derived from sub-resource
locator.
Paul.