tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smith <>
Subject Re: Dynamically add Filter to webapp without declaring in web.xml
Date Tue, 01 Aug 2006 20:08:05 GMT
Depending on your version of tomcat, ServletContextListener may be an 
excellent standard way to go.  There was a thread just a few days ago on 


Harakiri wrote:

>is it possible to dynamically add a Filter for a web
>app using the tomcat ? If so, is there an example how
>to do this ?
>OR is it possible to somehow init some webapps params
>before the Filter is loaded ? I tried to use a Servlet
>and used the <load-on-startup>1</load-on-startup>
>within the web.xml - however the servlet is loaded
>AFTER the filter is initialized (even when no web page
>has been requested). Is there a better approach then
>using a init servlet ?
>The problem i currently have, is that im using a 3rd
>party Security Filter which has "no knowledge" of my
>application and relies on some Configuration (access
>rights) which is initialized by my webapp. 
>A good example for this problem would be if you have
>dynamic Log4j configuration i.e. not using a log4j.xml
>in the classpath but configuring it through the java
>api. The Filter is already initialized when you do the
>log4j initializion in the init servlet - thus making
>it impossible to see/track an debug/error messages
>from the filter at all.
>Do You Yahoo!?
>Tired of spam?  Yahoo! Mail has the best spam protection around 
>To start a new topic, e-mail:
>To unsubscribe, e-mail:
>For additional commands, e-mail:

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

View raw message