Hello All-

Is it possible to set response header "Content-Encoding" to "gzip" in a
JSP.  I know it's possible in a servlet and I thought a jsp is more or
less a servlet.  The OutputStream is a JSPWriter rather than a
Printwriter and I'm not sure how deal with this.

I tried searching google for some code examples but no luck.  I will
appreciate any help you can give me.


        String encoding = request.getHeader("Accept-Encoding");
System.out.println("##### Encoding: " + encoding);
   
        if (encoding != null && encoding.indexOf("gzip") != -1) {
                OutputStream out1 = response.getOutputStream();
        out = new PrintWriter(new GZIPOutputStream(out1), false);
                response.setHeader("Content-Encoding" , "gzip");
        } else {
                out = response.getWriter();
        }

ERROR:
C:\JAVA\jakarta-tomcat-5.0.24\work\Catalina\localhost\_\org\apache\jsp\f
axing\sent_005ffaxes_jsp.java:122: incompatible types
found   : java.io.PrintWriter
required: javax.servlet.jsp.JspWriter
       out = new PrintWriter(new GZIPOutputStream(out1), false);

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to