Consider the code above
@Path("a")
@Produces("text/plain")
public class A {
@GET
@Path("a")
public String getA() {
return "a";
}
@GET
@Path("a")
public String getB() {
return "b";
}
}
Requesting http://host/a/a i always get "b".
What is the strategy to select the appropiated method ? Any way to get informed about multiple p开发者_如何转开发aths to diferent resources ?
Further edited in light of the comment
I don't know of any reporting tool within RESTEasy that offers a list of duplicated matching patterns across a range of annotated service classes. However, you could approach this problem using one of the following methods:
- grep and awk the source code for @Path to generate a sortable list of path expressions
- Use an AnnotationReader implementation to scan over your classpath as part of a unit test and have it detect duplicated regex patterns.
Edited to better target the question
RESTEasy uses a regex based system for paths and selects the most closely matching pattern. In the event of a collision the last one matched is used.
精彩评论