Sorry for the confusion. What I was trying to say was, it is the first strip of URI
string that has a matching url-pattern that counts and not just the longest. Container takes the whole URI and starts stripping from the end of URI to the next "/" and tries to find a match.
For examples, if I have following mappings
<servlet-mapping>
<servlet-name>DoxyzServlet</servlet-name><url-pattern>/do/this/ab/cd/ef/jk/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Do12Servlet</servlet-name><url-pattern>/12/*</url-pattern>
</servlet-mapping>
and I use
<host><context path>/12/do/this/whatto.do
or
<host><context path>/12/do/this/ab/cd/ef/jk/whatto.do
Do12Servlet will get executed, because /12/* is the matching mapping and not /do/this/ab/cd/ef/jk/*
-rao