Hi Michael,
I think Kyle suggestion is the best. However if you don't/can't use Apache as a web front end, have a look at your web/application server console to see if your can enable this behaviour.
If not, depending on the version of servlet engine you're using, you might be able to use a Filter servlet to do the compression. This provides better encapsulation of the feature.
Anyway, before performing gzip compression, you must ensure the client web browser supports the gzip compression.
Try to find the
word gzip in the
Accept-Encoding line in the request headers. If found, the client accepts gzip.
In that case, you can compress your output using the GZIPOutputStream, but do not forget to tell the client you are sending him a compressed stream by setting
gzip in the
Content-Encoding line of the server's response header.
Cheers