码迷,mamicode.com
首页 > Web开发 > 详细

J2EE Filter配置项url-pattern与servlet-name

时间:2015-11-17 13:07:47      阅读:194      评论:0      收藏:0      [点我收藏+]

标签:

url-pattern根据请求path路径进行过滤,servlet-name根据Servlet名称过滤

<filter>
	<filter-name>CompressingFilter</filter-name>
  <filter-class>
      com.utfs.util.compress.CompressingFilter
    </filter-class>
	</filter>
	<filter-mapping>
		<filter-name>CompressingFilter</filter-name>
		<url-pattern>*.js</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>CompressingFilter</filter-name>
		<url-pattern>*.css</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>CompressingFilter</filter-name>
		<url-pattern>*.gif</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>CompressingFilter</filter-name>
		<url-pattern>*.png</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>CompressingFilter</filter-name>
		<url-pattern>*.jpg</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>CompressingFilter</filter-name>
		<servlet-name>UmpDispatcherServlet</servlet-name>
	</filter-mapping>
	<filter-mapping>
		<filter-name>CompressingFilter</filter-name>
		<servlet-name>CodeServlet</servlet-name>
	</filter-mapping>
	<filter-mapping>
		<filter-name>CompressingFilter</filter-name>
		<url-pattern>/app/*</url-pattern>
	</filter-mapping>

另外需要了解,在Filter中除了使用sendRedirect之外无法进行请求转发

J2EE Filter配置项url-pattern与servlet-name

标签:

原文地址:http://my.oschina.net/ososchina/blog/531255

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!