过滤器配置拦截的请求类别 REQUEST FORWARD INCLUDE EXCEPTION
在servlet-2.3中Filter会过滤所有请求,包括服务器内部使用forward转发请求和<%@ include file="/index.jsp"%>的情况。
在servlet-2.4中Filter默认下只拦截外部提交的请求,forward和include这些内部转发都不会被过滤 ,若有需要配置如下。
<filter> <filter-name>FilterTest</filtername> <filter-class>com.sxfusion.filter.FilterTest</filter-class> </filter> <filter-mapping> <filter-name>FilterTest</filtername> <url-pattern>/*</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> <dispatcher>EXCEPTION</dispatcher> </filter-mapping> |