|
This is a Java servlet filter (as per Servlet API 2.3). GzipFilter lets you compress output from your jsp,html or Coldfusion pages. How to use it: a) download gzipflt.jar and save it in WEB-INF/lib b) describe this filter in web.xml.
<filter> <filter-name>GzipFilter</filter-name> <filter-class>com.cj.gzipflt.GzipFilter</filter-class> </filter> c) describe a mapping for this filter in web.xml
<filter-mapping> <filter-name>GzipFilter</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> in this case filter will be on for each your .jsp file And now when you invoke any .jsp page: http://your_host/your_page.jsp GzipFilter will check out client's browser settings. If browser does not support gzip, filter invokes resource normally. If browser does support gzip, output will be compressed. Also you can set the following initial parameters: minSize - describes a minimal size for the content to be compressed. By default is not defined
(compress always)
For example:
<filter> <filter-name>GzipFilter</filter-name> <filter-class>com.cj.gzipflt.GzipFilter</filter-class> <init-param> <param-name>mimeInclude</param-name> <param-value>text/plain,text/html,text/xml</param-value> </init-param> </filter> For downloading:
See also JSOS - the largest collection of servlets and filters. |
Also in JSOS:
|