You want to compress CocoonServlet output from Tomcat (Standalone) ?

First you need to have a Servlet-2.3 Servlet Engine (for example Tomcat 4.x)

Then you need to do just two things:

  1. Get CompressionFilter from Tomcat-Examples and put into your Cocoon-App

  2. Modify the WebApp Deployment Descriptor (WEB-INF/web.xml) of your Cocoon-App

  3. Change Document Type to

<!DOCTYPE web-app
  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"

    <filter-name>Compression Filter</filter-name>

    <filter-name>Compression Filter</filter-name>

Note that this will have a performance impact on your server, so test first. This probably works best with a reverse proxy in front for high traffic sites. Do also check if your reverse proxy does not support compression already. But then it might save you bandwidth and make the site virtually faster for the users as long as you have enough computing power for the compression.

TODO: Maybe Tomcat connected to Apache httpd via AJP13 and mod_gzip is a better solution, but haven't this tested though.

CocoonServletCompressionFilterSnippet (last edited 2009-09-20 23:40:41 by localhost)