File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes gzip error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "gzip error" Watch "gzip error" New topic
Author

gzip error

timothy passcal
Greenhorn

Joined: Oct 23, 2003
Posts: 9
This is the code in the servlet for transforming to gzip or not depending on the accept-encoding parameter
<code>
if (supportsGzip == true) {
GZIPOutputStream out = new GZIPOutputStream(res.getOutputStream());
res.setHeader("Content-Encoding", "gzip");
res.setContentType("text/html");
transformer.transform(xmlSource, new StreamResult(out));
out.close();
} else {
ServletOutputStream out = res.getOutputStream();
res.setContentType("text/html");
transformer.transform(xmlSource, new StreamResult(out));
out.close();
}
</code>
In most cases this works perfectly and the performance improvements are tremendous. But every once in a while I get garbled characters on the browser, IE or mozilla both do it.
Anyone come up against this. Would really appreciate it. Gotta roll this out soon.
TP.
timothy passcal
Greenhorn

Joined: Oct 23, 2003
Posts: 9
any ideas, clues, anyone?
 
 
subject: gzip error