HttpResponseHeader header = new HttpResponseHeader(200);
header.copyHeaderFrom(response.getResponseHeader());
header.setProtocol(getRequest().getProtocol());
header.setHeader("Connection", "close");
BodyDataSink bodyDataSink = HttpServerConnection.this.sendResponseHeader(header);
NonBlockingBodyDataSource bodyDataSource = response.getNonBlockingBody();
BodyForwarder forwarder = new BodyForwarder(bodyDataSource, bodyDataSink);
bodyDataSource.setDataHandler(forwarder);
return;
}
// http protocol version downgrade necessary?
if (isLargerOrEquals(response.getResponseHeader().getProtocolVersion(), getRequest().getRequestHeader().getProtocolVersion())) {
response.getResponseHeader().setProtocol(getRequest().getProtocol());
response.getResponseHeader().setHeader("Connection", "close");
}
}
} catch (Exception e) {
HttpResponse errorResponse = null;
if (HttpUtils.isShowDetailedError()) {
errorResponse = new HttpResponse(400, "text/html", generateErrorMessageHtml(400, DataConverter.toString(e), getId()));
} else {
errorResponse = new HttpResponse(400, "text/html", generateErrorMessageHtml(400, HttpUtils.getReason(400), getId()));
}
setResponseCommited(true);
HttpServerConnection.this.sendResponseMessage(errorResponse);
throw new IOException(e.toString());
}
if (response.getStatus() != 100) {
setResponseCommited(true);
}
BodyDataSink dataSink = HttpServerConnection.this.sendResponseMessage(response);
if (transactionMonitor != null) {
transactionMonitor.registerMessageHeaderSent(request, response.getResponseHeader(), dataSink);
if (response.hasBody()) {