wood burning stoves 2.0*
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: gzip error
 
Similar Threads
query regarding xml-html transformation
Using FOP
Question: How do you send a JSP page as compressed GZIP encoding?
Compressed servlet output with GZIP
IE 6 and GZIP