You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Matthew Thomas Broadhead <ma...@bodyaspect.co.uk> on 2007/12/10 11:02:23 UTC

server mapping behaviour when directory structure mirrors mappings

Recently upgraded Tomcat from version 4.1.31 to 6.0.14.

In my webapp I mapped servlets to paths without extensions
e.g.
<servlet-mapping>
	<servlet-name>Sales</servlet-name>
	<url-pattern>/sales</url-pattern>
</servlet-mapping>
Then in the root of the webapp there is a directory with the same  
name (e.g. sales) in which all the resources for that servlet are  
stored.

This worked fine in 4.1.31 but in 6.0.14 it adds a slash at the end  
of the url and behaves like it is in the root of the directory rather  
than loading the servlet mapping first.



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


RE: server mapping behaviour when directory structure mirrors mappings

Posted by Matthew Broadhead <ma...@bodyaspect.co.uk>.

Caldarale, Charles R wrote:
> 
>> From: Matthew Thomas Broadhead [mailto:matt@bodyaspect.co.uk] 
>> Subject: server mapping behaviour when directory structure 
>> mirrors mappings
>> 
>> <servlet-mapping>
>> 	<servlet-name>Sales</servlet-name>
>> 	<url-pattern>/sales</url-pattern>
>> </servlet-mapping>
> 
> If you look at the servlet spec (section 11.2), you'll see that the
> above is not valid other than for matching the exact request "/sales".
> Newer versions of Tomcat are more strict in their implementation of the
> rules in the spec, so it's not too surprising that 6.0 works properly
> and 4.1 let you slide by.
> 
> Looks like the <url-pattern> should really be "/sales/*" (without the
> quotes).
> 
>  - Chuck
> 

I want to match the pattern /sales but it instead adds an extra slash and
tries to list directory /sales/.  Is there any way to change the order in
which it resolves the url, i.e. check for servlet-mapping first, then check
for directory?
-- 
View this message in context: http://www.nabble.com/server-mapping-behaviour-when-directory-structure-mirrors-mappings-tp14250184p14273740.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


RE: server mapping behaviour when directory structure mirrors mappings

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Matthew Thomas Broadhead [mailto:matt@bodyaspect.co.uk] 
> Subject: server mapping behaviour when directory structure 
> mirrors mappings
> 
> <servlet-mapping>
> 	<servlet-name>Sales</servlet-name>
> 	<url-pattern>/sales</url-pattern>
> </servlet-mapping>

If you look at the servlet spec (section 11.2), you'll see that the
above is not valid other than for matching the exact request "/sales".
Newer versions of Tomcat are more strict in their implementation of the
rules in the spec, so it's not too surprising that 6.0 works properly
and 4.1 let you slide by.

Looks like the <url-pattern> should really be "/sales/*" (without the
quotes).

 - 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 start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org