FileDocCategorySizeDatePackage
CompressionFilterTestServlet.javaAPI DocApache Tomcat 6.0.141977Fri Jul 20 04:20:34 BST 2007compressionFilters

CompressionFilterTestServlet

public class CompressionFilterTestServlet extends HttpServlet
Very Simple test servlet to test compression filter
author
Amy Roh
version
$Revision: 500668 $, $Date: 2007-01-28 00:07:51 +0100 (dim., 28 janv. 2007) $

Fields Summary
Constructors Summary
Methods Summary
public voiddoGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)


        ServletOutputStream out = response.getOutputStream();
        response.setContentType("text/plain");

        Enumeration e = ((HttpServletRequest)request).getHeaders("Accept-Encoding");
        while (e.hasMoreElements()) {
            String name = (String)e.nextElement();
            out.println(name);
            if (name.indexOf("gzip") != -1) {
                out.println("gzip supported -- able to compress");
            }
            else {
                out.println("gzip not supported");
            }
        }


        out.println("Compression Filter Test Servlet");
        out.close();