A Java open source servlet filter to compress http responses using GZip.
| By: | Abdul Habra |
| Email: | ahabra@yahoo.com |
| URL: | www.tek271.com |
| Version: | 1.00 |
| Date: | 2007.11.28 |
Tek271 GzipServletFilter Java Docs.
tek271.gzipServletFilter.2007.11.28.zip: Source, JAR, JavaDocs.
This software is open source, free, and uses LGPL license.
Modern browsers can receive HTTP Response data in a compressed format (GZip). This compression can decrease the bandwidth requirement of web pages, and speeds up the display of these pages at the client. If you are running a Java web application you can use the Tek271 GzipServletFilter to transparently compress the data you send to the client. This compression will occur without any modifications or changes to your application's code.
Tek271 GzipServletFilter works as a Servlet Filter you install with your application. It will detect if the browser supports GZip compression, and if it does, the filter will compress the response data and sends it back to the client.
tek271.gzipServletFilter.jar file.tek271.gzipServletFilter.jar in your application's
class path. Usually this could be in your application's WEB-INF/lib directory.web.xml :<filter>
<filter-name>gzipFilter</filter-name>
<filter-class>com.tek271.gzipServletFilter.GzipServletFilter</filter-class>
<init-param>
<!-- optional: log filter usage to console -->
<param-name>isLog</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping> <!-- compress the
response for any html request -->
<filter-name>gzipFilter</filter-name>
<url-pattern>*.html</url-pattern>
</filter-mapping>
<filter-mapping>
<!-- compress the response for any jsp request -->
<filter-name>gzipFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>The setup above will cause all requests for *.html or *.jsp files to have GZip compressed responses. (If the client's browser does not support compression, then the filter will not do any compression).
You may wonder why create another implementation with all the above examples. I had the following reasons:
Version 1.00, 2007.11.28
First public release
| Page Last Updated 2007.11.28 |
|