JBoss 4:我应该在哪里部署全局过滤器?

编程入门 行业动态 更新时间:2024-10-24 01:56:38
本文介绍了JBoss 4:我应该在哪里部署全局过滤器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想使用全局" HTTP过滤器.

I want to use "global" HTTP filters.

为此,我编辑了deploy/jboss-web.deployer/conf/web.xml并添加:

Therefor, I edited deploy/jboss-web.deployer/conf/web.xml and added:

<filter> <filter-name>StatisticsFilterHitCount</filter-name> <filter-class>myapp.StatisticsFilterHitCount</filter-class> </filter> <filter-mapping> <filter-name>StatisticsFilterHitCount</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>

现在,当我启动服务器时,无法部署单个工件.每次部署尝试都会记录一个巨大的异常.抱歉,无法在此处粘贴.我想在部署时还没有过滤器类.

Now, when I start the server, not a single artifact can be deployed. A huge exception is logged on each deployment attempt. Sorry, can't paste it here. I suppose, at the time of deployment, the filter class is not present yet.

那么,我必须在哪里(以及如何)在全球范围内部署这种过滤器?

So, where (and how) do I have to deploy such filter globally?

当前在applications/5apps中,包装为.war.

推荐答案

查看Jboss/server/default/deploy/jboss-web.deployer/conf/web.xml. 甚至还有全局CommonHeadersFilter的示例.

Look at Jboss/server/default/deploy/jboss-web.deployer/conf/web.xml. There is even an example of global CommonHeadersFilter.

但是您必须将代码放在JBoss/server/default/lib下的某个jar中. JBoss无法在Web容器的初始化过程中窥探战争中的代码.

But you would have to place the code in some jar under JBoss/server/default/lib. JBoss can't peek up the code in the war at web container's initialization process.

更多推荐

JBoss 4:我应该在哪里部署全局过滤器?

本文发布于:2023-06-09 04:11:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/594981.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:过滤器   全局   JBoss

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!