Objectmix
Tags Register Mark Forums Read

Tomcat 5.0 web.xml filter mapping <url-pattern>/content/*.jsp : Java

This is a discussion on Tomcat 5.0 web.xml filter mapping <url-pattern>/content/*.jsp within the Java forums in Programming Languages category; I am having problem using filter mapping in in Tomcat 5.0 on windows I tried the following in my web.xml. .... <filter-mapping> <filter-name>foo.bar.MyFilter</filter-name> <url-pattern>/content/*.jsp</url-pattern> </filter-mapping> .... When I start Tomcat it tells me: SEVERE: Parse error in application web.xml java.lang.IllegalArgumentException: Invalid <url-pattern> /content/*.jsp in filter mapping at org.apache.commons.digester.Digester.createSAXException(Digester.java:2540) at org.apache.commons.digester.Digester.createSAXException(Digester.java:2566) at org.apache.commons.digester.Digester.endElement(Digester.java:1061) .... It doesn't do it in a friends Tomcat 4.1 on Linux Is this some kind of change in behavior from Tomcat 4.0 to 5.0? (Tomcat 5.0 is Servlet API 2.4 and JSP 2.0) The idea is that I want it to run my this filter before all ...


Object Mix > Programming Languages > Java > Tomcat 5.0 web.xml filter mapping <url-pattern>/content/*.jsp

Reply

 

LinkBack Thread Tools
  #1  
Old 02-27-2004, 07:13 PM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Tomcat 5.0 web.xml filter mapping <url-pattern>/content/*.jsp

I am having problem using filter mapping in in Tomcat 5.0 on windows
I tried the following in my web.xml.
....
<filter-mapping>
<filter-name>foo.bar.MyFilter</filter-name>
<url-pattern>/content/*.jsp</url-pattern>
</filter-mapping>
....
When I start Tomcat it tells me:
SEVERE: Parse error in application web.xml
java.lang.IllegalArgumentException: Invalid <url-pattern> /content/*.jsp in
filter mapping
at org.apache.commons.digester.Digester.createSAXException(Digester.java:2540)
at org.apache.commons.digester.Digester.createSAXException(Digester.java:2566)
at org.apache.commons.digester.Digester.endElement(Digester.java:1061)
....

It doesn't do it in a friends Tomcat 4.1 on Linux
Is this some kind of change in behavior from Tomcat 4.0 to 5.0?
(Tomcat 5.0 is Servlet API 2.4 and JSP 2.0)

The idea is that I want it to run my this filter before all JSP pages, but
not with all .jpg, .gif requests that come in, even if they are within
the some directory structure.

Seems simple enough in the example from a friends Tomcat 4.0

-Paul

  #2  
Old 02-27-2004, 11:57 PM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: Tomcat 5.0 web.xml filter mapping <url-pattern>/content/*.jsp

P.Hill wrote:
> <filter-mapping>
> <filter-name>foo.bar.MyFilter</filter-name>
> <url-pattern>/content/*.jsp</url-pattern>
> </filter-mapping>


Upon further reading, I have discovered that my
friend can't be trusted. *.jsp doesn't work in
4.1, and it complains as I reported in 5.0.

My solution at this time is to allow requests
for things other than jsps through the same
filter to skip the filtering, since the filter
doesn't need to kick in just because someone
is asking for background.jpg or some such.

Yeah, I know we might consider rearranging the
dir structure to put jsps separate from content,
but that doesn't seem like a useful step at this
time.

Other ideas?

-Paul

  #3  
Old 08-27-2004, 09:02 AM
Junior Member
 
Join Date: Nov 2009
Posts: 0
Application Development is on a distinguished road
Default Re: Tomcat 5.0 web.xml filter mapping <url-pattern>/content/*.jsp

We had the same problem with a jsp-property-group url-pattern, and I did
some searches on google on this topic (that's how I ended up in here for
example)

Most clear result I found was:

http://www.mail-archive.com/tomcat-d.../msg43676.html

Where it says that mapping /somepath/*.something worked in a version of
tomcat, but is removed since it does not comply with the Servlet
specification.

This is what the servlet specification (2.4) allows:

- 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.
- 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.


So what you (and we) are trying to do, cannot be done according to the
Servlet 2.4 specification.

Reply

Thread Tools


Similar Threads

Thread Thread Starter Forum Replies Last Post
Novice Tomcat design pattern question usenet Java 9 12-03-2007 12:07 PM
Re: Setting a response header in a Tomcat Filter usenet Java 3 08-29-2007 09:56 AM
Tomcat servlet-mapping question usenet Java 0 07-17-2007 06:29 PM
Content Filter - Mercury32 usenet Pegasus 2 10-17-2006 03:47 PM
filter pattern question usenet Pine 2 10-14-2005 07:55 AM


All times are GMT -5. The time now is 01:10 AM.

Managed by Infnx Pvt Ltd.