tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kees de Kooter <kdekoo...@gmail.com>
Subject Re: Filter versus Valve
Date Thu, 12 Feb 2009 08:05:32 GMT
Could you post the code of your valve and your filter?

Please also not that a Valve is a tomcat specific thing i.e. not
portable to other app servers. A Filter is part of the servlet spec
and portable.


On Thu, Feb 12, 2009 at 06:13, Jake Vang <vangjake@googlemail.com> wrote:
> I've been looking for a way to modify my request header. I found that
> implementing javax.servlet.Filter is the way to go. However, I noticed that
> once after I got my Filter implementation working, my Valve is no longer
> reached (I created my own Valve subclassing
> org.apache.catalina.valves.ValveBase). I've determined this because I've
> placed breakpoints in the Filter.doFilter(...) method and Valve.invoke(...)
> methods, and only the breakpoint in the Filter class implementation is
> caught.
>
> My context XML for my web application is:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Context path="/my-valve"
>    docBase="C:\my-valve\dist"
>    reloadable="true">
>    <Valve className="vang.jake.tomcat.valve.ModifyHeaderValve" />
> </Context>
>
> My web.xml for my web application is:
>
>     <filter>
>        <filter-name>simpleFilter</filter-name>
>        <filter-class>vang.jake.servlet.filter.SimpleFilter</filter-class>
>    </filter>
>    <filter-mapping>
>        <filter-name>simpleFilter</filter-name>
>        <url-pattern>/*</url-pattern>
>    </filter-mapping>
>
> Could someone clarify if the use of one (filter) precludes the use of the
> other (valve)? If so, why? If not, why is my valve never reached?
>
> Thanks.
>

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


Mime
View raw message