tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
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 <aw@ice-sa.com> 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
<url-pattern>*.xyz</url-pattern>

and I have for filter B (the one to disable) a
<servlet-name>servletX</servlet-name>

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., "something.abc", so that filter B does not run 
anymore.

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

Yes ?

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

André

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


Mime
View raw message