I am trying to send compressed data to the client.  The following code will
compress the data, but rather than forcing a "Save As/Open With" dialog box,
it simply writes the binary data to the container window (i.e the client's
browser).
Does anybody know how to commpress data and send the resulting "zipped"
information to the client.
(Please note that due to system restraints, I cannot create a temp file on
the server.)


{current output is as follows:
PK     -QE) test??
P?,.Q??I,.NU(?KQ(N??K?? PK  Yy?   PK     -QE)Yy?    testPK   2N
}

code excerpt:

<%@ import="java.io.*, java.util.zip.*" %>
<%
        ZipOutputStream o = new ZipOutputStream(response.getOutputStream());

        ZipEntry z = new ZipEntry("test");

        o.putNextEntry(z);

        String a = "ZIP ist Klasse und schnell";

        o.write(a.getBytes());
        o.flush();
        o.close();

        response.setHeader("Content-Encoding", "application/zip");
%>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to