views:

193

answers:

3

In a J2EE application, how do I create a global Filter that can access other webapps installed on that app server?

A: 

There is no way to do this in a container/platform independent way. Your J2EE container might provide hooks for you to do this though.

Kevin
+1  A: 

The Servlet-API does not provide such a security leak. But some containers offer alike. Have a look at the <Valve> Configuration of Apache Tomcat. Maybe there is a similar functionality for webshere, but typically you need to hire a ibm consultant to "find" the configuration.

Arne Burmeister
+1  A: 

Some application servers/servlet containers (Tomcat, JBoss) provide the cross context feature. It does depend on what you're running your application within however, it's not a J2EE feature.

http://tomcat.apache.org/tomcat-5.5-doc/config/context.html

I'm not sure whether this will help you in what you want to do. What is it exactly? : )

Take a look at this response as well:

http://stackoverflow.com/questions/661978/what-does-the-crosscontext-attribute-do-in-tomcat-does-it-enable-session-sharing

Jon
Like JBoss, Websphere also uses Tomcat under the hoods and if I recall my rusty Websphere experiences correctly, the very similar `crossContext` setting is just available at Websphere. This way you could create a webapp which runs on the ROOT and run the filter on `/*`. But again, that's the theory, I can't confirm this from own experience. Alternatively you could declare the filter in appserver's own `web.xml`. +1 for the hint regardless :)
BalusC