in src/main/java/org/apache/sling/engine/impl/SlingRequestProcessorImpl.java [445:465]
public PrintWriter getWriter() throws IOException {
if (writer == null) {
try {
writer = super.getWriter();
} catch (IllegalStateException ise) {
// resetting the response did not reset the output channel
// status and we have to create a writer based on the output
// stream using the character encoding already set on the
// response, defaulting to ISO-8859-1
OutputStream out = getOutputStream();
String encoding = getCharacterEncoding();
if (encoding == null) {
encoding = "ISO-8859-1";
setCharacterEncoding(encoding);
}
Writer w = new OutputStreamWriter(out, encoding);
writer = new PrintWriter(w);
}
}
return writer;
}