Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Re: cannot get Filters to work with Tomcat 5.0.16

Jean-Francois Arcand

2004-01-06

Replies:

To be sure your web.xml is correct, turn xml validation on. In
server.xml, replace:

   <Host name="localhost" debug="0" appBase="webapps"
    unpackWARs="true" autoDeploy="true"
    xmlValidation="false" xmlNamespaceAware="false">


by

   <Host name="localhost" debug="0" appBase="webapps"
    unpackWARs="true" autoDeploy="true"
    xmlValidation="true" xmlNamespaceAware="true">

That may help next time you see such problem.

-- Jeanfrancois

Patrick Scheuerer wrote:

> Shapira, Yoav wrote:
>
>> Howdy,
>> OK, now that's the 3rd different version of the filter elements in your
>> web.xml ;) You shouldn't have both servlet-name and url-pattern
>> children of filter-mapping, only one of them.
>
>
> I tried to add the filters with the Struts Studio Web Deployment
> Editor just as another test. It's quite interesting: Struts Studio
> tells me that <servlet-name> is required. But in the DTD it says
> <servlet-url> OR <servlet-name>. So i guess that's a bug in Struts
> Studio. It also put the empty <servlet-name> element there although
> left the field blank...
>
> Anyway, I tried it with the correct version like this
> <filter>
>   <filter-name>UserFilter</filter-name>
>   <filter-class>ch.ctc.support.common.UserFilter</filter-class>
> </filter>
>
> <filter>
>   <filter-name>AdminFilter</filter-name>
>   <filter-class>ch.ctc.support.common.AdminFilter</filter-class>
> </filter>
>
> <filter-mapping>
>   <filter-name>UserFilter</filter-name>
>   <url-pattern>/*</url-pattern>
>
> </filter-mapping>
>
> <filter-mapping>
>   <filter-name>AdminFilter</filter-name>
>   <url-pattern>/admin/*</url-pattern>
> </filter-mapping>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
> For additional commands, e-mail: tomcat-user-help@(protected)
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)



©2008 junlu.com - Jax Systems, LLC, U.S.A.