对于Tomcat5.0以后的版本是支持对输出内容进行压缩的。使用的是gzip压缩格式
<Connector port ="80" maxHttpHeaderSize ="8192"
maxThreads ="150" minSpareThreads ="25" maxSpareThreads ="75"
enableLookups ="false" redirectPort ="8443" acceptCount ="100"
connectionTimeout ="20000" disableUploadTimeout ="true" URIEncoding ="utf-8" />
<!-- Note : To disable connection timeouts, set connectionTimeout value to 0 -->
<!-- Note : To use gzip compression you could set the following properties :
compression="on"
compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml"
-->
从上面的第8行内容可以看出,要使用gzip压缩功能,你可以在Connector实例中加上如下属性即可:
阅读剩余全文 »