I'm writing a RESTful Web Service with RESTeasy. This is an implementation of JAX-RS. You annotate a class or method with a single @Path annotation. Regular expressions are used to get path parameters. For instance
@Path("/foo{varname:.*}/bar")
matches all patterns starting with "/foo", ending with "/bar" and having anything in between. Whatever is in between is assigned to a parameter named varname.
Some frameworks (like Django) have a list of regular expressions and methods that will be tried in order. For instance /john/q/smith, /john/{.*}/smith, /john/{.*}/{.*}. "/john/henry/smith" matches the second and third, but the second one will be dispatched because it is the first match found.
Is this possible in JAX-RS, or is there no inherent order to the classes and methods? For /john/{.*}/{.*} would you have to write a regex that means /john/anything/anythingbutsmith? You would have to change it every time you changed the other ones.