This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara 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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA 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?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: gzip error