How to add filters to servlet without modifying web.xml

后端 未结 3 433
醉话见心
醉话见心 2020-12-07 15:24

I\'d like the ability to modify/configure filters in a different way than web.xml. Here is a static configuration of 2 filters. I\'d like the ability to have one filter stat

3条回答
  •  悲&欢浪女
    2020-12-07 15:27

    Servlet 3.0 has the @WebFilter annotation to define a filter. No need to declare it in web.xml anymore.

    But loading a filter from a filter is not supported. You could implement it yourself: it's "just" the chain of responsibility pattern, but why would you?

提交回复
热议问题