This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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
Compressed servlet output with GZIP
Question: How do you send a JSP page as compressed GZIP encoding?
IE 6 and GZIP
Using FOP
query regarding xml-html transformation