public void outputReady(final NHttpServerConnection conn, final ContentEncoder encoder) {
HttpContext context = conn.getContext();
HttpResponse response = conn.getHttpResponse();
ServerConnState connState = (ServerConnState) context.getAttribute(CONN_STATE);
ContentOutputBuffer buffer = connState.getOutbuffer();
// Update connection state
connState.setOutputState(ServerConnState.RESPONSE_BODY_STREAM);
try {
buffer.produceContent(encoder);
if (encoder.isCompleted()) {
// Notify the worker thread of the connection state
// change
synchronized (connState) {