response.setCharacterEncoding(CHARSET);
ServletOutputStream servletOutputStream = response.getOutputStream();
XML xml = getXML();
ByteArrayOutputStream w = new ByteArrayOutputStream();
boolean hack = status != HttpServletResponse.SC_OK; // hack to disable IE "friendly error messages" :-(
xml.toDocument(w, CHARSET);
int length = w.size();
if (hack) {
length += blank.length;
}
response.setContentLength(length);