On 4/25/2013 12:52 PM, Caldarale, Charles R wrote:
From: Christopher Schultz [mailto:ch...@christopherschultz.net]
Subject: Re: Question on servlet determination
http://localhost:8080/examples/servlets/servlet/RequestInfoExample
I get the example page with pathInfo=ll
http://localhost:8217/examples/servlets/servlet/RequestInfoExample/
I also get the example page with pathInfo=
My question is why the top url (with no trailing /) is getting the
request at all, given the url-pattern in web.xml:
<servlet-mapping>
<servlet-name>RequestInfoExample</servlet-name>
<url-pattern>/servlets/servlet/RequestInfoExample/*</url-pattern>
</servlet-mapping>
Likely because of these clauses in the spec:
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.
A string beginning with a '/' character and ending with a '/*' suffix
is used for path mapping.
(The above is from 3.0, section 12.1, rule 2, and section 12.2, first bullet.)
But I haven't looked at the code to see how it's actually implemented.
- Chuck
I think you're right. It looks like it boils down to an interpretation
of the rules. If you look a little further at the examples, this is an
exact match for the /baz/* mapping.
-Terence Bandoian
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org