users@grizzly.java.net

Re: GZIP'ing content ...

From: Oleksiy Stashok <Oleksiy.Stashok_at_Sun.COM>
Date: Thu, 28 Aug 2008 16:44:13 +0200

>> Does it mean compressing is working on Grizzly side? :)
>
> yes Alexey -- stand down the troops! ;)
:)


>>> btw ... i was looking at an old post, and wanted to figure out if
>>> i can see how much data i am savng by GZIP'ing, but looking at the
>>> RequestGroupInfo class i don't see a way to know this.
>> AFAIK there is no such possibility with embedded Grizzly/Tomcat GZIP.
>
> Incidentally i am not running within any J2EE server; i am using
> Grizzly directly.
The same GZIP logic is used in both server/standalone modes.
Anyway, IMHO, it's not possible to get this number with current
implementation.

However you can spend some time implementing your own Gzip filter,
which will have such a feature.

Here are several steps:

1)
Current GZIP implementation relies on
com.sun.grizzly.tcp.http11.filters.GzipOutputFilter class, which you
can find under grizzly/modules/http-utils. You can extend this filter
functionality...

2)
Once you'll complete custom GzipOutputFilter implementation - you'll
need to extend class com.sun.grizzly.http.DefaultProcessorTask
(grizzly/modules/http module), in specifically method
initializeFilters, which has following line:
     protected void initializeFilters() {
          --------------------- cut ---------------------------
         // Create and add the chunked filters.
         //inputBuffer.addFilter(new GzipInputFilter());
         outputBuffer.addFilter(new GzipOutputFilter());

     }

so your ProcessorTask implementation should add custom
GzipOutputFilter instead of default one.

3)
Next step, once you'll have custom ProcessorTask - you will need to
extend default SelectorThread implementation of method:
     protected ProcessorTask newProcessorTask(boolean initialize){
         DefaultProcessorTask task =
                 new DefaultProcessorTask(initialize, bufferResponse);
         return configureProcessorTask(task);
     }

and return your custom ProcessorTask implementation instead of the
default one.

Hope this will help.

Thanks.

WBR,
Alexey.

>
>
> --
> Alan Williamson
> Registrationless email/sms reminders: http://yourli.st/
> blog: http://alan.blog-city.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>