Filter配置多个url-pattern
java开发中会用的Filter过滤器,有时候开发需要,在一个Filter中需要配置多个过滤地址,即<url-pattern>,下面就说一下一个Filter过滤器中多个<url-pattern>的配置方法:
<filter> <filter-name>CORSFilter</filter-name> <filter-class>xxx.filter.CORSFilter</filter-class> </filter> <filter-mapping> <filter-name>CORSFilter</filter-name> <url-pattern>/pages/aaa/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>CORSFilter</filter-name> <url-pattern>/pages/bbb/*</url-pattern> </filter-mapping>
海纳百川 有容乃大 壁立千仞 无欲则刚