> 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=null

> 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


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to