2012-12-31

GZip servlet filter from the JSP book

The filter code is here in the class com.jspbook.GZipFilter.

The PJL Compression Filter is allegedly better.

Usage:

<web-app>

  <!-- GZip filter -->
  <filter>
    <filter-name>gzip</filter-name>
    <filter-class>com.jspbook.GZIPFilter</filter-class>
  </filter>

  <filter-mapping>
    <filter-name>gzip</filter-name>
    <url-pattern>*.js</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>gzip</filter-name>
    <url-pattern>*.css</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>gzip</filter-name>
    <url-pattern>*.html</url-pattern>
  </filter-mapping>
  <filter-mapping>
    <filter-name>gzip</filter-name>
    <url-pattern>*.texy</url-pattern>
  </filter-mapping>

</web-app>

0