JBoss 4:我应该在哪里部署全局过滤器? [英] JBoss 4: where do I deploy global filters?

查看:145
本文介绍了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:我应该在哪里部署全局过滤器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆