users@grizzly.java.net

Re: SelectorThread.setCompression("on");

From: Alan Williamson <alan_at_blog-city.com>
Date: Mon, 11 Feb 2008 15:09:22 +0000

aaah, well i am writing my own response out with the following:

------------------------

        public void send(Response response) throws IOException {
                try{
                
                        response.setCharacterEncoding("UTF-8");
            response.setContentLength( length );
            response.setContentType( httpContentType );
            response.setStatus( httpResponseCode );
            response.setMessage( httpResponseText );
        
            if ( cookieOut != null ) response.addHeader("Set-Cookie", cookieOut );
            if ( locationOut != null ) response.addHeader("Location",
locationOut );
            if ( eTag != null ) response.addHeader( "ETag", eTag );
            if ( lastModified != null ) response.addHeader( "Last-Modified",
DateUtil.getHttpDate(lastModified) );
        
            if ( !bSendHeaderOnly ){
                    ByteChunk chunk = new ByteChunk( length );
                    chunk.append( bodyToSend, 0, length );
                    OutputBuffer buffer = response.getOutputBuffer();
                    buffer.doWrite(chunk, response);
            }

                }finally{
                        response.finish();
                }
        }
------------------------

so it does seem to suggest that i have to manage this myself,
determining if the client can accept GZIP or not

Jeanfrancois Arcand wrote:
> Hi Alan,
>
> Alan Williamson wrote:
>> Can some explain how outgoing compression is suppose to work within
>> Grizzly?
>>
>> I *think* i may have misunderstood it. I have it set to on, and
>> compress anything above 15KB. However nothing is being compressed.
>>
>> I take it then when i do something like this:
>>
>> OutputBuffer buffer = response.getOutputBuffer();
>> buffer.doWrite(chunk, response);
>>
>> Grizzly isn't automatically compressing this if the outgoing client
>> supports GZIP?
>
> Yes, via its output filter
>
> https://grizzly.dev.java.net/nonav/xref/com/sun/grizzly/tcp/http11/filters/GzipOutputFilter.html
>
>>
>> does that mean i have to manage this myself?
>
> No grizzly supports it (at least in GlassFish :-))
>
> http://weblogs.java.net/blog/jfarcand/archive/2006/06/enabling_http_c_1.html
>
>
> How did you configure it exactly? If it doesn't work, it probably
> because of a bug. Last week I've ported some final fix from 1.0 which we
> missed. Which version of Grizzly are you using?
>
> Thanks
>
> -- Jeanfrancois
>
>
>
>>
>> thanks
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>

-- 
Alan Williamson
  Professional Self Publishing Packages
    http://www.Blog-City.com/
  myBlog = 'http://alan.blog-city.com/';