if (LOG.isDebugEnabled())
LOG.debug("onContent called with response: {} and content: {}. Sending response content to client.",
response, content);
final ByteBuffer contentCopy = httpClient.getByteBufferPool().acquire(content.remaining(), true);
BufferUtil.flipPutFlip(content, contentCopy);
ByteBufferDataInfo dataInfo = new ByteBufferDataInfo(contentCopy, false);
clientStream.data(dataInfo, new Callback()
{
@Override
public void failed(Throwable x)
{
LOG.debug("failed: ", x);
releaseBuffer();
response.abort(x);
}
@Override
public void succeeded()
{
releaseBuffer();
}
private void releaseBuffer()
{
httpClient.getByteBufferPool().release(contentCopy);
}
});
}
@Override
public void onSuccess(Response response)
{
if (LOG.isDebugEnabled())
LOG.debug("onSuccess called. Closing client stream.");
clientStream.data(new ByteBufferDataInfo(BufferUtil.EMPTY_BUFFER, true), LOGGING_CALLBACK);
}
@Override
public void onFailure(Response response, Throwable failure)
{