FileDocCategorySizeDatePackage
CompressionFilterTestServlet.javaAPI DocGlassfish v2 API3127Fri May 04 22:34:12 BST 2007compressionFilters

CompressionFilterTestServlet

public class CompressionFilterTestServlet extends HttpServlet
Very Simple test servlet to test compression filter
author
Amy Roh
version
$Revision: 1.3 $, $Date: 2007/05/05 05:34:11 $

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();