You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by George Sexton <ge...@mhsoftware.com> on 2015/09/18 21:48:37 UTC

Filter Mapping URL Pattern

I'm trying to add a filter mapping with the URL-Pattern

<url-pattern>/*.css</url-pattern>

and tomcat (7.0.63) is throwing an error on the deployment descriptor:

java.lang.IllegalArgumentException: Invalid <url-pattern /*.css in 
filter mapping.
at 
org.apache.catalina.core.StandardContext.validateFilterMap(StandardContext.java: 
3136)

from looking at StandardContext.validateURLPattern(), it appears that 
"*." is invalid.

Can someone direct me to a a BNF definition of what's an acceptable 
url-pattern in the specification, or some portion of the servlet spec 
that explains the implementation of StandardContext.validateURLPattern()?

-- 
George Sexton
*MH Software, Inc.*
Voice: 303 438 9585
http://www.mhsoftware.com

Re: Filter Mapping URL Pattern

Posted by George Sexton <ge...@mhsoftware.com>.

On 9/18/2015 1:57 PM, Caldarale, Charles R wrote:
>> From: George Sexton [mailto:georges@mhsoftware.com]
>> Subject: Filter Mapping URL Pattern
>> I'm trying to add a filter mapping with the URL-Pattern
>> <url-pattern>/*.css</url-pattern>
> Which, unfortunately, isn't allowed.  You probably just need to remove the leading slash.

Thanks. That got me on the right track.

>
>> Can someone direct me to a a BNF definition of what's an acceptable
>> url-pattern in the specification, or some portion of the servlet spec
>> that explains the implementation of StandardContext.validateURLPattern()?
> See section 12.2 of the servlet spec (not quite BNF, but probably good enough):
>
> In the Web application deployment descriptor, the following syntax is used to define
> mappings:
> ■ A string beginning with a '/' character and ending with a '/*' suffix is used for
> path mapping.
> ■ A string beginning with a '*.' prefix is used as an extension mapping.
> ■ The empty string ("") is a special URL pattern that exactly maps to the
> application's context root, i.e., requests of the form http://host:port/<contextroot>/.
> In this case the path info is '/' and the servlet path and context path is
> empty string ("").
> ■ A string containing only the '/' character indicates the "default" servlet of the
> application. In this case the servlet path is the request URI minus the context path
> and the path info is null.
> ■ All other strings are used for exact matches only.
>
>   - 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-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

-- 
George Sexton
*MH Software, Inc.*
Voice: 303 438 9585
http://www.mhsoftware.com

RE: Filter Mapping URL Pattern

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: George Sexton [mailto:georges@mhsoftware.com] 
> Subject: Filter Mapping URL Pattern

> I'm trying to add a filter mapping with the URL-Pattern
> <url-pattern>/*.css</url-pattern>

Which, unfortunately, isn't allowed.  You probably just need to remove the leading slash.

> Can someone direct me to a a BNF definition of what's an acceptable 
> url-pattern in the specification, or some portion of the servlet spec 
> that explains the implementation of StandardContext.validateURLPattern()?

See section 12.2 of the servlet spec (not quite BNF, but probably good enough):

In the Web application deployment descriptor, the following syntax is used to define
mappings:
■ A string beginning with a '/' character and ending with a '/*' suffix is used for
path mapping.
■ A string beginning with a '*.' prefix is used as an extension mapping.
■ The empty string ("") is a special URL pattern that exactly maps to the
application's context root, i.e., requests of the form http://host:port/<contextroot>/.
In this case the path info is '/' and the servlet path and context path is
empty string ("").
■ A string containing only the '/' character indicates the "default" servlet of the
application. In this case the servlet path is the request URI minus the context path
and the path info is null.
■ All other strings are used for exact matches only.

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