in src/main/java/org/apache/sling/engine/impl/SlingHttpServletResponseImpl.java [154:178]
public void setStatus(final int sc, final String msg) {
if (this.isProtectHeadersOnInclude()) {
// ignore
return;
}
if (isCommitted()) {
if (flusherStacktrace != null && flusherStacktrace != FLUSHER_STACK_DUMMY) {
LOG.warn("Response already committed. Failed to set status code from {} to {}.",
getStatus(), sc, flusherStacktrace);
} else {
String explanation = flusherStacktrace != null
? "Enable debug logging to find out where the response was committed."
: "The response was auto-committed due to the number of bytes written.";
LOG.warn("Response already committed. Failed to set status code from {} to {}. {}",
getStatus(), sc, explanation);
}
} else { // response is not yet committed, so the statuscode can be changed
if (msg == null) {
super.setStatus(sc);
} else {
super.setStatus(sc, msg);
}
}
}