users@grizzly.java.net

Re: Compression

From: Oleksiy Stashok <oleksiy.stashok_at_oracle.com>
Date: Mon, 04 Jun 2012 19:40:54 +0200

On 06/01/2012 09:03 PM, Jonathan Louie wrote:
> Hi,
>
> I'm trying to enable gzip compression support in Grizzly. Searching
> has been not particularly fruitful.
>
> Is SelectorThread.setCompression() still the preferred way?
>
>
Hi,

which Grizzly version are you using?
If it's 1.9.x and less, then these SelectorThread's methods are applicable:

     /**
      * Sets the compression level. The acceptable <code>compression</code>
      * parameter values are:
      * 1) <b>off</b>: never compress HTTP response content
      * 2) <b>force</b>: force HTTP response content compression regardless
      * {_at_link #getCompressionMinSize()}, {_at_link
#getCompressableMimeTypes()},
      * {_at_link #getNoCompressionUserAgents()} limitations. This
mode might be
      * particularly useful for testing purposes.
      * 3) <b>on</b>: enable compression for HTTP response content, if
the HTTP
      * request/response headers conform to the
      * {_at_link #getCompressionMinSize()}, {_at_link
#getCompressableMimeTypes()},
      * {_at_link #getNoCompressionUserAgents()} requirements.
      *
      * Pls note: for "on" and "force" compression levels, the
      * compression will be applied to HTTP response content only
      * in case if corresponding HTTP request contains appropriate
Accept-Encoding
      * header.
      */
     public void setCompression(String compression);

     /**
      * Sets the min size (in bytes) of HTTP response payload, the
compression might be applied on.
      */
     public void setCompressionMinSize(int compressionMinSize);


Thanks.

WBR,
Alexey.