tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: enabling/disabling a servlet filter conditionally
Date Fri, 01 Aug 2008 22:30:27 GMT
Hassan Schroeder wrote:
> On Fri, Aug 1, 2008 at 1:39 PM, André Warnier <> wrote:
>> Can one dynamically disable a servlet filter under some conditions, from
>> within another preceding filter ?
> You could /probably/ -- untested conjecture -- break the FilterChain at
> that point by forwarding to a URL for which Filter B wasn't applied (or
> was applied only to a REQUEST rather than FORWARD.
On second read, can you elaborate on that one ?
Do I understand correctly, as follows ?

Originally, I have for the servlet a <url-pattern> like, for instance

and I have for filter B (the one to disable) a

I would
a) replace this last by a <url-pattern>*.xyz</url-pattern>

b) make filter A, in case it doesn't want filter B to run, change the 
request URL to, e.g., "", so that filter B does not run 

c) change the servlet def. so that it handles url-patterns "*.abc" AND 

Yes ?

If that works, that's a clever idea, which seems not too difficult to 
implement, even for me.


To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message