我想使用全局" 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:我应该在哪里部署全局过滤器?
发布评论