resin中配置Gzip只需要在resin配置文件中加入一个filter即可,参数见下面的官方解释:
GzipFilter
The GzipFilter compresses the output of pages for browsers which understand compression, and leaves the output unchanged if the browser does not support compression. A browser indicates to the server that it supports gzip compression by including “gzip” in the “Accept-Encoding” request header.
GzipFilter is available in Resin-Professional.
use-vary Set the standard HTTP “Vary” response header to “Accept-Encoding”. This indicates to the browser and any intervening cache that the response from this url might be different depending on the Accept-Encoding provided by the browser. true
no-cache Forbid the browser and any intervening cache from caching the results of this request. Sets the “Cache-Control” response header to “no-cache”. If use-vary is false then this is always true. false
embed-error-in-output Embed the stack trace of any exception into the output stream that is being sent to the browser. false
<web-app xmlns=”http://caucho.com/ns/resin”>
<filter filter-name=”gzip”
filter-class=”com.caucho.filters.GzipFilter”/>
<filter-mapping url-pattern=”/*” filter-name=”gzip”/>
</web-app>
See com.caucho.filters.GzipFilter.
Leave a Reply