// the length of the resulting XML file is unknown due to
// formatting: response.setContentLength(xml.length());
try {
Writer writer = new OutputStreamWriter(response.getOutputStream());
StateChangeLogGenerator statstics = new StateChangeLogGenerator(writer, em);
statstics.writeCompleteStatistics();
} catch (IOException e) {
facesMessages.addError("An error occured while generating stage statistics.");
log.error("An error occured while generating stage statistics.", e);
}