compression and compressionMinSize in GlassFish v3
Friday Sep 26, 2008
In Enabling HTTP Compression in GlassFish, Jean-Francois discussed about compression in GlassFish. There are four properties to configure compression, namely:
- compression
- compressionMinSize (in OCTET)
- compressableMimeType
- noCompressionUserAgents
compression = force and
compression = off respectively.
And one can also turn on the compression
if the content-length is unknown or known to be greater than a certain size.
There are two properties related to this: compression and compressionMinSize.
In this blog, we will discuss various ways to accomplish this scenario
in GlassFish v3.
compression vs compressionMinSize
| property | possible value if set | Default |
|---|---|---|
| compression | on, force, off, integer | off |
| compressionMinSize | integer | 2048 |
There are several possible combinations. We will summarize the behaviors of GlassFish v3 in the below table. In the following, α and β are integers.
| compression | compressionMinSize | Result |
|---|---|---|
| on | β | compression with min size β |
| on | not set | compression with default min size (2048) |
| force | β or not set | compression with no size constraint |
| α | β or not set | compression with min size α |
| off or not set | β or not set | no compression |
So, roughly speaking, whenever there is conflicting information between compression and compressionMinSize, the compression property will take precedence.
Since we use strict inequality to check for known content length, the following are equivalent:
compression = forcecompression = onandcompressionMinSize = any negative integer
How to test it?
If one has turned on compression in GlassFish, then one will get HTTP compression if the HTTP request is- using HTTP 1.1
- with a HTTP header:
Accept-Encoding: gzip - the content-length is unknown or greater than the compression minimum size
(orcompression = force)
- Content-Encoding: gzip











Will it support gzip stream from client, too?
Regarding the "OCTET": "compression...