I try the same think but for my case, it doesn't work properly with IE 4.1

you can try this code :


        OutputStream out = null;

        String encodings = req.getHeader("Accept-Encoding");

        if (encodings != null && encodings.indexOf("gzip") !=-1)
        {
                // Gzip
                res.setHeader("Content-Encoding","x-gzip");
                out = new GZIPOutputStream(res.getOutputStream());
        }
        else if (encodings != null && encodings.indexOf("compress") !=-1)
        {
                // Zip
                res.setHeader("Content-Encoding","x-compress");
                out = new ZipOutputStream(res.getOutputStream());
                ((ZipOutputStream) out).putNextEntry(new ZipEntry("dummy
name"));

        }
        else
        {
                // pas de compression
                out = res.getOutputStream();
        }
        res.setHeader("Vary","Accept-Encoding");


-----Original Message-----
From: David M. Karr [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 29, 2000 8:02 PM
To: [EMAIL PROTECTED]
Subject: use GZIPOutputStream w/JDK1.3 for encoding from
servlet->browser?


Is there a known problem with GZIPOutputStream in JDK 1.3, with
respect to using the "Content-Encoding" of "gzip", displaying in
either Netscape or IE?

I was stepping through the examples in "Core Servlets and JavaServer
Pages", and I tried the EncodedPage.java example (listing 4.2).  When
I turned off encoding, the page displayed fine, but with encoding, it
displayed in the browser as just a couple of random scrozzled
characters.

I'm using Apache & Tomcat3.1 on NT, and I've tested this with Netscape
4.7.x, Mozilla nightly, and IE5.

--
============================================================================
===
David M. Karr     ; [EMAIL PROTECTED]  ; w:(425)487-8312 ; TCSI & Best
Consulting
Software Engineer ; Unix/Java/C++/X ; BrainBench CJ12P (#12004)

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to