use of org.apereo.portal.utils.DelegatingServletOutputStream in project uPortal by Jasig.
the class PortletHttpServletResponseWrapper method getOutputStream.
@Override
public ServletOutputStream getOutputStream() throws IOException {
if (this.servletOutputStream == null) {
final OutputStream out;
if (logger.isDebugEnabled()) {
out = new ByteArrayOutputStream() {
@Override
public void close() throws IOException {
super.close();
final byte[] data = this.toByteArray();
if (data.length > 0) {
logger.warn("Ignored {} bytes written to ServletOutputStream by {}\n\n{}", new Object[] { data.length, portletWindow, new String(data) });
}
}
};
} else {
out = new CountingOutputStream(NullOutputStream.NULL_OUTPUT_STREAM) {
@Override
public void close() throws IOException {
super.close();
final long byteCount = this.getByteCount();
if (byteCount > 0) {
logger.warn("Ignored {} bytes written to ServletOutputStream by {}, turn on DEBUG logging to see the output", byteCount, portletWindow);
}
}
};
}
this.servletOutputStream = new DelegatingServletOutputStream(out);
}
return this.servletOutputStream;
}
Aggregations