Skip to content

zhangyaowu/JEE-Cache-Filter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

JEE-Cache-Filter

在专项优化web性能过程中写的Cache Filter,服务端是Tomcat7。最优缓存策略制定参见我的文章:web性能优化(二) 合理利用浏览器缓存


####使用参考

  • DisableETagFilter
    web.xml filter配置
<filter>
		<filter-name>disableETagFilter</filter-name>
		<filter-class>com.huawei.universe.ckm.web.filter.DisableETagFilter</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>disableETagFilter</filter-name>
		<servlet-name>default</servlet-name>
	</filter-mapping>
  • CacheFilter
    web.xml filter配置
<filter-name>cacheFilter</filter-name>
		<filter-class>com.huawei.universe.ckm.web.filter.CacheFilter</filter-class>
		<init-param>
			<param-name>expiration</param-name>
			<param-value>31536000</param-value>
		</init-param>
		<!--<init-param>
			<param-name>vary</param-name>
			<param-value>Accept-Encoding</param-value>
		</init-param>
		<init-param>
			<param-name>private</param-name>
			<param-value>true</param-value>
		</init-param>-->
	</filter>
	<filter-mapping>
		<filter-name>cacheFilter</filter-name>
		<url-pattern>*.jpeg</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>cacheFilter</filter-name>
		<url-pattern>*.png</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>cacheFilter</filter-name>
		<url-pattern>*.css</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>cacheFilter</filter-name>
		<url-pattern>*.js</url-pattern>
	</filter-mapping>

About

JEE Cache Filter for Tomcat

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages