java filter filter-mapping配置多个url-pattern

 

一、正确的配置方法,配置多个filter-mapping

<filter>  
    <filter-name>authority</filter-name>  
    <filter-class>com.util.AuthorityFilter</filter-class>  
</filter>  
<filter-mapping>  
    <filter-name>authority</filter-name>  
    <url-pattern>/pages/genbill/*</url-pattern>  
</filter-mapping>  
<filter-mapping>  
    <filter-name>authority</filter-name>  
    <url-pattern>/pages/cmm/*</url-pattern>  
</filter-mapping>

 

二、tomcat下正确,websphere下只能处理最后一个url-pattern

<filter>  
    <filter-name>authority</filter-name>  
    <filter-class>com.util.AuthorityFilter</filter-class>  
</filter>  
<filter-mapping>  
    <filter-name>authority</filter-name>  
    <url-pattern>/pages/cmm/*</url-pattern>  
    <url-pattern>/pages/genbill/*</url-pattern>  
</filter-mapping> 

 

三、错误的

<filter>  
    <filter-name>authority</filter-name>  
    <filter-class>com.util.AuthorityFilter</filter-class>  
</filter>  
<filter-mapping>  
    <filter-name>authority</filter-name>  
    <url-pattern>/pages/cmm/*;/pages/genbill/*</url-pattern>  
</filter-mapping>  

 

你可能感兴趣的:(java,filter,多个,filter-mapping,url-pattern)