Lets assume that web.xml has a rule <servlet-mapping> <servlet-name>One</servlet-name> <url-pattern>/something/e*</url-pattern> </servlet-mapping>
While class Two.class has an annotation: @WebServlet(name = "Two", urlPatterns = {"/something/er*"}) >From the Servlet 3.0 specification 8.2.3. (point 4). `The web.xml of the web application has the highest precedence when resolving conflicts between the web.xml, web-fragment.xml and annotations.` While 12.2 states: The container will recursively try to match the longest path-prefix. This is done by stepping down the path tree a directory at a time, using the ’/’ character as a path separator. The longest match determines the servlet selected. So for the request /something/error Tomcat will choose Two.class? And more general, in the case there are both annotation and web.xml rule with the same prefix length, it will choose a first occurrence in web.xml? If no one knows the answers but knows where to look in the source code, that could be beneficial as well. Thanks