On Wed, 28 Mar 2001, Bartosz Staniszewski wrote:

> Hello, AL!
> If i uderstand, your code is a servlet body?
> But we search for other kind of solution...
> We have application running on the web, and we want add gzip functionality
> to its all (without some exceptions - small sites, gif and jpg's) contents
> without modifications in jsp sources.
> As You wrote mod_gzip is a less flexible solution (if i'm right - i didn't
> try it). I try to write a request Interceptor for this.
> We can't migrate to Tomcat 4.0 as long as it is beta. With valves - new
> features of 4.0 version, dynamic compressing of some contents should be
> easier.
> 

It's too bad you can't migrate.  Tomcat 4.0-beta-2 also includes a Filter
that performs on-the-fly compression for you if the client supports it,
and if the response size is larger than a configurable number of
bytes.  This relies on the new Filter API of the Servlet 2.3 spec, so it
is even portable to other 2.3-based containers as they are released.

> Thanks,
> Stanisz
> 

Craig


> -----Original Message-----
> From: Alistair Hopkins [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, March 27, 2001 4:15 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: RE: Compressing Tomcat output.
> 
> 
> We have a conditional compression setup: if some pages are small, it is
> better not to compress them as the time the browser takes to decompress
> makes the site slower on aggregate, esp with netscape.
> 
> The settings to control whether we zip and the threshold at which to zip can
> then be adjusted for the most responsive 'feel'
> 
>                       import java.util.zip.*;
> .
> .
> ByteArrayOutputStream bytes;
>  (put html into bytes)
> ..............................
>                     bytes.writeTo(out);
>                     out.close();
>                 }
>                 else
>                 {
>                     resource.log.debug("no zip");
>                     bytes.writeTo(response.getOutputStream());
>                 }
> Works well.
> 
> AL
> 
> 
> 

Reply via email to