General J2EE: how to make a filter intercept request to all webapp in a server
- Posted by: Jorge Alberto
- Posted on: September 28 2005 13:35 EDT
I need to install a filter(javax.servlet.Filter) that intercepts http requests to any web application installed in a web server...there is a way to make that???
I mean if client query http://server:port/webapp1/... or http://server:port/webapp2/... the filter has to be executed
Thanks in advance...
- Not that I know of by Jakob Jenkov on September 28 2005 13:51 EDT
- You should be able to with Tomcat by Brian Ross on September 28 2005 16:06 EDT
I don't think that is possible using standard J2EE features. Perhaps your application / web server has some features for that? I think Jetty has, but they won't be standard functions, meaning they won't be portable across app/web servers.
Anyone else knows more about this?
In Tomcat, applications are configured by the global web.xml file followed by the app-specific one in WEB-INF. So, if you go to <TOMCAT_HOME>/conf/web.xml and add the following as the first child of the web-app element, it should work for all web apps:
But in production we are using WAS, there is a way?? :(
I don't know WAS, but whatever you would have to do would be different than Tomcat.
You might be best off defining the filter in each application's web.xml individually, so that it will be portable.
Sorry all, this is just a test.