The Source for Java Technology Collaboration
User: Password:
Register | Login help    

Search

Online Books:
java.net on MarkMail:


Enabling HTTP Compression in GlassFish

Posted by jfarcand on June 7, 2006 at 11:33 AM PDT

Glassfish b06 now support HTTP Compression, the same way Tomcat is supporting it. Several options are availaible (from Tomcat docs):

compressableMimeType: The value is a comma separated list of MIME types for which HTTP compression may be used. The default value is text/html,text/xml,text/plain.

compression: The Connector may use HTTP/1.1 GZIP compression in an attempt to save server bandwidth. The acceptable values for the parameter is "off" (disable compression), "on" (allow compression, which causes text data to be compressed), "force" (forces compression in all cases), or a numerical integer value (which is equivalent to "on", but specifies the minimum amount of data before the output is compressed). If the content-length is not known and compression is set to "on" or more aggressive, the output will also be compressed. If not specified, this attribute is set to "off".

noCompressionUserAgents: The value is a comma separated list of regular expressions matching user-agents of HTTP clients for which compression should not be used, because these clients, although they do advertise support for the feature, have a broken implementation. The default value is an empty String (regexp matching disabled).

minCompressionSize: The minimum size of a file when compression is applied.

You can enable HTTP compression using two approaches:

The fastest way is to edit ${glassfish.home}/domains/domain/config/domain.xml, and add, under the http-listener element:

    <http-listener>
        <property name="compression" value="on"/>
        <property name="compressableMimeType" value="...."/>
    </http-listener>

Or you can using do it using GlassFish admin CLI:

% asadmin set server.http-service.http-listener.http-listener-1.
property.compression=force

Once Issue 607 is fixed, you gonna be able to use the Admin Gui to configure HTTP compression as well. technorati:
Related Topics >> Java Enterprise      
Comments
Comments are listed in date ascending order (oldest first)