tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jake Vang <vangj...@googlemail.com>
Subject Filter versus Valve
Date Thu, 12 Feb 2009 05:13:09 GMT
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.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message