在Jboss EAP 7.0中,这对我有用:
如何为Jboss 5.1.0启用gzip压缩?
在tomcat http连接器内吗?我不记得该文件的存储位置,server.xml?
该文件在server.xml下,您正确地指出必须更新http连接器。
以下链接是tomcat的信息,但同样适用于JBoss,但server.xml文件的位置除外。我相信您需要在deploy \ jbossweb.sar \
下更新server.xml。http://viralpatel.net/blogs/2008/11/enable-gzip-compression-in-tomcat.html
编辑jboss \ server \ default \ deploy \ jbossweb.sar \ server.xml
编辑此:
<Connector protocol="HTTP/1.1" port="8080" address="${jboss.bind.address}"
connectionTimeout="20000" redirectPort="8443" />
更像这样:
<Connector protocol="HTTP/1.1" port="8080" address="${jboss.bind.address}" compression="on"
compressableMimeType="text/html,text/xml,text/css,text/javascript, application/x-javascript,application/javascript"
connectionTimeout="20000" redirectPort="8443" />
您可以参考连接器配置信息以了解更多详细信息,请参阅:http://tomcat.apache.org/tomcat-5.5-doc/config/http.html
要在JBoss 7.1.1]中添加gzip压缩,您可以编辑standalone / configuration / standalone.xml并添加:
... </extensions> <system-properties> <property name="org.apache.coyote.http11.Http11Protocol.COMPRESSION" value="on"/> <property name="org.apache.coyote.http11.Http11Protocol.COMPRESSION_MIME_TYPES" value="text/javascript,text/css,text/html"/> </system-properties>
重新启动服务器,并使用开发人员工具或在HTTP标头中进行检查(如果已启用。)>
在Jboss EAP 7.0中,这对我有用:
编辑:Standalone.xml
<subsystem xmlns="urn:jboss:domain:undertow:1.2"> <!-- SEARCH FOR THIS: urn:jboss:domain:undertow --> <buffer-cache name="default"/> <server name="default-server"> <http-listener name="default" socket-binding="http"/> <host name="default-host" alias="localhost"> (...) <!-- ADD THIS FOR GZIP COMPRESSION --> <filter-ref name="gzipFilter" predicate="exists['%{o,Content-Type}'] and regex[pattern='(?:application/javascript|text/css|text/html|text/xml|application/json)(;.*)?', value=%{o,Content-Type}, full-match=true]"/> <!-- /GZIP COMPRESSION --> </host> </server> (...) <filters> (...) <!-- ADD THIS FOR GZIP COMPRESSION --> <gzip name="gzipFilter"/> <!-- /GZIP COMPRESSION --> </filters> </subsystem>
重新启动服务器
在Jboss EAP 7.0中,这对我有用: