How do web.xml filters work? Can you have two filters map to all pages (/*) and specify the order?

陌路散爱 提交于 2019-12-21 07:05:04

问题


I want to use Spring Security, and it says to map the filter to /***. But I already have a filter mapped to /*, which is the Tuckee URLRewrite filter.

Is it possible to map two filters to the same thing, and also is there a way to specify the order that the filters get called?


回答1:


Yes, you can:

The servlet 2.5 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

i.e. it depends on the order of your <filter-mapping> elements in the web.xml



来源:https://stackoverflow.com/questions/2122455/how-do-web-xml-filters-work-can-you-have-two-filters-map-to-all-pages-and

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!