您可以将WebFilter打包到库中吗 [英] Can you package a WebFilter into a library

查看:73
本文介绍了您可以将WebFilter打包到库中吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果是的话,你该怎么做?.

And if so how do you do it?.

是的,听起来像我的最后一个问题.这本质上是相同的问题.我有一个@javax.servlet.annotation.WebFilter,当直接打包到战争中时,它可以很好地工作.现在,我想将过滤器移至库中.但是,如果我这样做了,就不再称呼它了.

Yes sounds like my last question. And it is essentially the same problem. I have a @javax.servlet.annotation.WebFilter which works fine when packaged directly into a war. Now I would like to move the filter in to a library. But if I do so it won't be called any more.

我必须注意的任何陷阱,还是完全不可能?

Any pitfalls I have to look out for or is it just plain impossible?

推荐答案

设置<web-app metadata-complete="false">.

这意味着此Web应用程序的元数据不限于此特定的xml(以及Webapp的类),而是可以使用第三方库提供的元数据.

This means that the metadata for this web application is not limited to this particular xml (and the classes of the webapp), but can use metadata by 3rd party libraries.

也请看一下网页片段".您可以在jar的META-INF中定义一个web-fragment.xml,然后在其中映射所有servlet和过滤器.

Also take a look at "web fragments". You can define a web-fragment.xml in META-INF of your jar, and map all servlets and filters there.

看看这个演示.

这篇关于您可以将WebFilter打包到库中吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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