Alexander Berndt created SLING-3743:
---------------------------------------
Summary: BackgroundHttpServletResponse don't flushes the Writer
Key: SLING-3743
URL: https://issues.apache.org/jira/browse/SLING-3743
Project: Sling
Issue Type: Bug
Reporter: Alexander Berndt
Priority: Minor
A sling servlet request can be run as a background service, while appending a
?sling:bg=true to the request. This is done in the
BackgroundServletStarterFilter.
Unfortunatily this doesn't work for servlets, that use request.getWriter() to
create the output. The provided BackgroundHttpServletResponse provides also a
writer, but this isn't flushed during the clean-up.
So the current code:
public BackgroundHttpServletResponse(HttpServletResponse hsr, OutputStream os)
throws IOException {
stream = new ServletOutputStreamWrapper(os);
writer = new PrintWriter(new OutputStreamWriter(stream));
}
public void cleanup() throws IOException {
stream.flush();
stream.close();
}
should be changed to:
public void cleanup() throws IOException {
writer.flush();
writer.close();
}
as the writer also flushes and closes the underlying stream.
kind regards,
Alexander Berndt
--
This message was sent by Atlassian JIRA
(v6.2#6252)