Enabling gzip compression for Jboss

僤鯓⒐⒋嵵緔 提交于 2019-12-20 09:31:30

问题


How is gzip compression for Jboss 5.1.0 enabled?

Within the tomcat http connector right? I cant remember where this file is stored, server.xml?


回答1:


The file is under server.xml and you are correct in stating that you have to updated the http connector.

Following link is info for tomcat, but same applies to JBoss except location of server.xml file. I believe you need to update the server.xml under deploy\jbossweb.sar\

http://viralpatel.net/blogs/2008/11/enable-gzip-compression-in-tomcat.html




回答2:


edit jboss\server\default\deploy\jbossweb.sar\server.xml

Edit this:

<Connector protocol="HTTP/1.1" port="8080" address="${jboss.bind.address}" 
           connectionTimeout="20000" redirectPort="8443" />

to be more like this:

<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" />

You can refer to connector config info for further details please see: http://tomcat.apache.org/tomcat-5.5-doc/config/http.html




回答3:


To add gzip compression in JBoss 7.1.1, you can edit standalone/configuration/standalone.xml and add:

       ...
    </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>

Restart the server and check with developer tools or in the HTTP header if it is enabled.



来源:https://stackoverflow.com/questions/2994420/enabling-gzip-compression-for-jboss

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!