代码之家  ›  专栏  ›  技术社区  ›  tinny

为Jboss启用gzip压缩

  •  10
  • tinny  · 技术社区  · 15 年前

    如何为Jboss 5.1.0启用gzip压缩?

    3 回复  |  直到 15 年前
        1
  •  10
  •   Waleed Al-Balooshi    15 年前

    该文件位于server.xml下,您正确地指出必须更新http连接器。

    下面的链接是tomcat的信息,但除了server.xml文件的位置之外,JBoss也有同样的信息。我认为您需要更新deploy\jbossweb.sar下的server.xml\

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

        2
  •  16
  •   Community CDub    11 年前

    编辑此项:

    <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

        3
  •  15
  •   nimrod    12 年前

    ,您可以编辑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>
    

        4
  •  2
  •   Roger Vega    5 年前

    在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>
    

    重新启动服务器