tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <knst.koli...@gmail.com>
Subject Re: Question on servlet determination
Date Wed, 24 Apr 2013 20:46:49 GMT
2013/4/25 Christopher Schultz <chris@christopherschultz.net>:
>
> Konstantin,
>
> On 4/24/13 3:56 PM, Konstantin Kolinko wrote:
>> 2013/4/24 Christopher Schultz <chris@christopherschultz.net>:
>>>
>>> On 4/23/13 11:35 PM, Caldarale, Charles R wrote:
>>>>> From: Jeffrey Janner [mailto:Jeffrey.Janner@PolyDyne.com]
>>>>> Subject: Question on servlet determination
>>>>
>>>>> <url-pattern>/Servlet1</url-pattern>
>>>>> <url-pattern>/Servlet2</url-pattern>
>>>>
>>>> What happens if you try this instead:
>>>>
>>>> <url-pattern>/Servlet1/*</url-pattern>
>>>> <url-pattern>/Servlet2/*</url-pattern>
>>>
>>> While that should work, the original mapping should work, too.
>>> The request for /Servlet1 (plus a slash on the end) should be
>>> sent to Servlet1 with pathInfo="/".
>>>
>>
>> No. An URL that does not end with "/*" is used for exact matching
>> only.
>>
>> /foo and /foo/* are two different mappings.
>>
>> BTW, 1. in the examples webapp of Tomcat 6 and Tomcat 7 there is
>> RequestInfoExample servlet that you can play around with. E.g.
>>
>> http://localhost:8080/examples/servlets/servlet/RequestInfoExample/foo/bar
>>
>>  Adding an extra "/" works correctly.
>
> I notice that, although the <url-pattern> is
> "/servlets/servlet/RequestInfoExample/*", the trailing "/" is not
> required in order to get the request mapped properly. That's
> surprising to me given that "/foo" and "/foo/*" should be two
> different mappings.
>
> I'm specifically looking at the examples in Tomcat 7.0.39.
>

No. With the following pattern requesting the "../foo/bar" URI above
results in 404 for me.
(In current 7.0.x, should not be different from 7.0.39).
<url-pattern>/servlets/servlet/RequestInfoExample</url-pattern>

>> Adding an extra "/" works correctly.

My "adding" here is "adding to request URI in web browser",
.
http://localhost:8080/examples/servlets/servlet/RequestInfoExample
http://localhost:8080/examples/servlets/servlet/RequestInfoExample/

Best regards,
Konstantin Kolinko

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


Mime
View raw message