利用压缩传输与缓存提高网站速度
2012-07-20 15:30:09 来源:WEB开发网一、在有限带宽窗口里提高传输的内容才是重点
<filter>
<filter-name>GZIPFilter</filter-name>
<filter-class>com.tacitknowledge.filters.gzipfilter.GZIPFilter</filter-class>
</filter>
<!-- GZIPFilter 设置自己想要压缩的文件类型-->
<filter-mapping>
<filter-name>GZIPFilter</filter-name>
<url-pattern>*.js</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>GZIPFilter</filter-name>
<url-pattern>*.css</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>GZIPFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<!-- CacheFilter缓存定义 设置此项时tk-filters.properties的CacheFilter.Enabled=true才可用 -->
<filter>
<filter-name>CacheFilter</filter-name>
<filter-class>com.tacitknowledge.filters.cache.CacheHeaderFilter</filter-class>
</filter>
<!-- CacheFilter 设置自己想要缓存的文件类型-->
<filter-mapping>
<filter-name>CacheFilter</filter-name>
<url-pattern>*.gif</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheFilter</filter-name>
<url-pattern>*.jpg</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>*.js</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CacheFilter</filter-name>
<url-pattern>*.css</url-pattern>
</filter-mapping>
更多精彩
赞助商链接