开发者

How to specify filter priorities in java web apps?

开发者 https://www.devze.com 2023-01-20 20:51 出处:网络
Hello I wish I could define two filters like this <filter-mapping> <filter-name>SecurityFilter</filter-name>

Hello I wish I could define two filters like this

  <filter-mapping>
    <filter-name>SecurityFilter</filter-name>
    <url-pattern>/*</u开发者_如何学JAVArl-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>ContextFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

with the same pattern /* in my web.xml file, and I wish I could be sure the SecurityFilter will be executed before the other. Is there a way to do so?


You just did. From Sun's XSD:

The order in which filters are invoked is the order in which filter-mapping declarations that match a request URI for a servlet appear in the list of filter-mapping elements.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号