Gzip pipeline


In this wiki there are other alternatives for generating gzip compressed output, a feature of HTTP 1.1. The advantage of this implementation is that it doesn't require any specific serializer or reader implementation. Unlike implementations that use servlet filters, gzip compression can be controlled from the sitemap, and content-length calculation is determined by serializers and readers.


First declare the new components in the sitemap:

        <map:action name="gzip" logger="pipe.gzip" src="fcc.ima.cocoon.GzipAction"/>
<map:pipes default="gzip-no-cache">
        <map:pipe name="gzip-no-cache" src="fcc.ima.cocoon.GzipNonCachingProcessingPipeline" 

Create a pipe that is gzip aware:

        <map:pipeline type="gzip-no-cache">
                <map:match src="my-url">
                        <map:act type='gzip'/>
                        <map:read src='my-file'/>

In order to activate gzip compression use:

<map:act type='gzip'/>

and for deactivating it:

<map:act type='gzip'>
        <map:parameter name='use' value='0'/>

You can (de)activate compression as many times as needed in a pipeline.

Source code

See attachments.


To do

See also

Comments and improvements are welcome!.

My email address is dperezcar at fcc dot es (rename at and dot).

Attachment: GzipNonCachingProcessingPipeline.java
Attachment: GzipAction.java

GzipPipeline (last edited 2009-09-20 23:40:53 by localhost)