Example usage for org.apache.http.nio.protocol HttpAsyncResponseConsumer consumeContent

List of usage examples for org.apache.http.nio.protocol HttpAsyncResponseConsumer consumeContent

Introduction

In this page you can find the example usage for org.apache.http.nio.protocol HttpAsyncResponseConsumer consumeContent.

Prototype

void consumeContent(ContentDecoder decoder, IOControl ioctrl) throws IOException;

Source Link

Document

Invoked to process a chunk of content from the ContentDecoder .

Usage

From source file:org.apache.http.impl.nio.client.MainClientExec.java

@Override
public void consumeContent(final InternalState state, final ContentDecoder decoder, final IOControl ioctrl)
        throws IOException {
    if (this.log.isDebugEnabled()) {
        this.log.debug("[exchange: " + state.getId() + "] Consume content");
    }//from   w ww  . j a  va  2 s .  c  om
    if (state.getFinalResponse() != null) {
        final HttpAsyncResponseConsumer<?> responseConsumer = state.getResponseConsumer();
        responseConsumer.consumeContent(decoder, ioctrl);
    } else {
        final ByteBuffer tmpbuf = state.getTmpbuf();
        tmpbuf.clear();
        decoder.read(tmpbuf);
    }
}

From source file:org.apache.http.impl.nio.client.PipeliningClientExchangeHandlerImpl.java

@Override
public void consumeContent(final ContentDecoder decoder, final IOControl ioctrl) throws IOException {
    if (this.log.isDebugEnabled()) {
        this.log.debug("[exchange: " + getId() + "] Consume content");
    }/*from  w  w w .  j  av  a2 s.  c o  m*/
    final HttpAsyncResponseConsumer<T> responseConsumer = this.responseConsumerRef.get();
    Asserts.check(responseConsumer != null, "Inconsistent state: response consumer is null");
    responseConsumer.consumeContent(decoder, ioctrl);
}