@Override public boolean committed() { return rsp.committed(); }
@Override public void end() { if (!rsp.committed()) { if (status == null) { status(rsp.statusCode()); } writeCookies(); /** * Do we need to figure it out Content-Length? */ boolean lenSet = rsp.header("Content-Length").isPresent() || rsp.header("Transfer-Encoding").isPresent(); if (!lenSet) { int statusCode = status.value(); boolean hasBody = true; if (statusCode >= 100 && statusCode < 200) { hasBody = false; } else if (statusCode == 204 || statusCode == 304) { hasBody = false; } if (hasBody) { rsp.header("Content-Length", "0"); } } } rsp.end(); }
@Override public boolean committed() { return rsp.committed(); }
@Override public void end() { if (!rsp.committed()) { if (status == null) { status(rsp.statusCode()); } writeCookies(); /** * Do we need to figure it out Content-Length? */ boolean lenSet = rsp.header("Content-Length").isPresent() || rsp.header("Transfer-Encoding").isPresent(); if (!lenSet) { int statusCode = status.value(); boolean hasBody = true; if (statusCode >= 100 && statusCode < 200) { hasBody = false; } else if (statusCode == 204 || statusCode == 304) { hasBody = false; } if (hasBody) { rsp.header("Content-Length", "0"); } } } rsp.end(); }