----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

This is the zipped code that I am trying on Linux
server with apache and jserv. The code works on
netscape browser but not on I.E from a windows server
with JSWDK. I get garbled text in Netscape as well as
I.E using Apache.

______________________________________________________
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.zip.*;

public class EncodedPage extends HttpServlet {
  public void doGet(HttpServletRequest request,
                    HttpServletResponse response)
      throws ServletException, IOException {
    response.setContentType("text/html");
    String encodings =
request.getHeader("Accept-Encoding");
    String encodeFlag =
request.getParameter("encoding");
    PrintWriter out;
    String title;
    System.out.print("encodings= "+encodings+"
encodeFlag= "+encodeFlag);
    if ((encodings != null) &&
        (encodings.indexOf("gzip") != -1) &&
        !"none".equals(encodeFlag)) {
      title = "Page Encoded with GZip";
      OutputStream out1 = response.getOutputStream();
      out = new PrintWriter(new
GZIPOutputStream(out1), false);
      response.setHeader("Content-Encoding","x-gzip");
    } else {
      title = "Unencoded Page";
      out = response.getWriter();
    }
out.println("<DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML
4.0 Transitional//EN\" \n <HTML>\n"+
"<HEAD><TITLE>" + title + "</TITLE></HEAD>\n" +
"<BODY BGCOLOR=\"#FDF5E6\">\n<H1 ALIGN=CENTER>" +
title + "</H1>\n");
    String line = "Blah, blah, blah, blah, blah.";
    for(int i=0; i<2; i++) {
      out.println(line);
    }
    out.println("</BODY></HTML>");
    out.close();
  }
}


____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie


--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search Archives: 
<http://www.mail-archive.com/java-apache-users%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to