Example usage for org.apache.http.nio.entity ContentBufferEntity ContentBufferEntity

List of usage examples for org.apache.http.nio.entity ContentBufferEntity ContentBufferEntity

Introduction

In this page you can find the example usage for org.apache.http.nio.entity ContentBufferEntity ContentBufferEntity.

Prototype

public ContentBufferEntity(final HttpEntity entity, final ContentInputBuffer buffer) 

Source Link

Document

Creates new instance of ContentBufferEntity.

Usage

From source file:org.elasticsearch.client.HeapBufferedAsyncResponseConsumer.java

@Override
protected void onEntityEnclosed(HttpEntity entity, ContentType contentType) throws IOException {
    long len = entity.getContentLength();
    if (len > bufferLimitBytes) {
        throw new ContentTooLongException("entity content is too long [" + len
                + "] for the configured buffer limit [" + bufferLimitBytes + "]");
    }/*from  w ww  . j  a  v  a 2 s .c om*/
    if (len < 0) {
        len = 4096;
    }
    this.buf = new SimpleInputBuffer((int) len, getByteBufferAllocator());
    this.response.setEntity(new ContentBufferEntity(entity, this.buf));
}