1. 程式人生 > >resin開啟gzip壓縮

resin開啟gzip壓縮

在web.xml中新增如下內容:

<filter filter-name="gzip" filter-class="com.caucho.filters.GzipFilter">
		   <init>
		     <use-vary>false</use-vary>
		   </init>
    </filter>

    <filter-mapping filter-name="gzip">
	    <url-pattern>
	      <include-pattern>/book/catalog/all</include-pattern>
	      <include-pattern>/book/bookDetail</include-pattern>
	    </url-pattern>
    </filter-mapping>

開啟瀏覽器,訪問應用,可以看響應頭中Content-Encoding:gzip