tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject enabling/disabling a servlet filter conditionally
Date Fri, 01 Aug 2008 20:39:59 GMT

Can one dynamically disable a servlet filter under some conditions, from 
within another preceding filter ?

In other words, suppose I have a servlet configured approximately like 
this :

      ... filterA parameters ...
      ... filterB parameters ...
     ... servlet parameters ...

And suppose that I control the code of filter A but have no access to 
the code of filter B, and filter B has no parameter allowing to make it 

Can I, from within filter A, which gets to see the request first, based 
on some characteristic of the request, decide that for this request I 
want to disable (or short-circuit or bypass) filter B ?
And if yes, could you point me in the right direction/documentation 
about how to do this ?
I can write simple filters and simple servlets, but am not really an 
habitual Java programmer.

Thanks in advance,

P.S. While we are at it,
- would the same apply if I had a third filter C ? Could I, in filter A, 
decide to disable filter B or filter C or both ?
- and/or, suppose that for filter C I would also have access to the 
code, could I design some mechanism whereby filter A could "tell" filter 
C not to do anything for this request ?

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

View raw message