适用于所有 Web 应用程序的全局过滤器
在 J2EE 应用程序中,如何创建可以访问该应用程序服务器上安装的其他 Web 应用程序的全局过滤器?
In a J2EE application, how do I create a global Filter that can access other webapps installed on that app server?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
如果有人仍然感兴趣,以下是我对这个问题的发现:
对于 tomcat 和其他从它派生的 web 应用服务器(例如:JBoss),您可以将过滤器添加到“全局”web.xml,通常位于$TOMCAT_HOME/conf/web.xml。
对于 Websphere,我发现以下文章很有用:http://www-03.ibm.com/support/techdocs/atsmastr.nsf/WebIndex/WP101859。在本例中,基本思想是编写一个 ServletContext Listener 并使用它将过滤器附加到应用程序
In case anyone is still interested, here are my findings regarding this question:
For tomcat and others webapp servers derived from it (eg: JBoss), you can add your filter to the "global" web.xml, usually located under $TOMCAT_HOME/conf/web.xml.
For Websphere, I´ve found the following article to be useful: http://www-03.ibm.com/support/techdocs/atsmastr.nsf/WebIndex/WP101859 . In this case, the basic idea is that you write a ServletContext Listener and uses it to attach your filter to the app
Servlet-API 不提供此类安全漏洞。但有些容器提供类似的服务。查看 Apache Tomcat 的
配置。也许 webshere 有类似的功能,但通常您需要聘请 ibm 顾问来“查找”配置。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.一些应用程序服务器/servlet 容器(Tomcat、JBoss)提供跨上下文功能。它确实取决于您在其中运行应用程序的内容,但是,它不是 J2EE 功能。
http://tomcat.apache.org/tomcat-5.5-doc/ config/context.html
我不确定这是否会帮助您完成您想做的事情。到底是什么? :)
也看看这个响应:
Tomcat 中的 crossContext 属性有什么作用?它是否启用会话共享?
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:
What does the crossContext attribute do in Tomcat? Does it enable session sharing?
无法以独立于容器/平台的方式做到这一点。不过,您的 J2EE 容器可能会提供钩子供您执行此操作。
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.
这对我有用: https://stackoverflow.com/a/8815211/964681
抱歉,不能只是评论你的问题。没有足够的“积分”。
This worked for me: https://stackoverflow.com/a/8815211/964681
Sorry, couldn't just comment on your question. Haven't enough "points".