Example usage for org.apache.http.nio.protocol HttpAsyncRequestProducer produceContent

List of usage examples for org.apache.http.nio.protocol HttpAsyncRequestProducer produceContent

Introduction

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

Prototype

void produceContent(ContentEncoder encoder, IOControl ioctrl) throws IOException;

Source Link

Document

Invoked to write out a chunk of content to the ContentEncoder .

Usage

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

@Override
public void produceContent(final InternalState state, final ContentEncoder encoder, final IOControl ioctrl)
        throws IOException {
    if (this.log.isDebugEnabled()) {
        this.log.debug("[exchange: " + state.getId() + "] produce content");
    }/*from w  ww  .  j a va  2s .c  o  m*/
    final HttpAsyncRequestProducer requestProducer = state.getRequestProducer();
    state.setRequestContentProduced();
    requestProducer.produceContent(encoder, ioctrl);
    if (encoder.isCompleted()) {
        requestProducer.resetRequest();
    }
}

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

@Override
public void produceContent(final ContentEncoder encoder, final IOControl ioctrl) throws IOException {
    if (this.log.isDebugEnabled()) {
        this.log.debug("[exchange: " + getId() + "] produce content");
    }/*  w  ww  .j a va  2  s . c  om*/
    final HttpAsyncRequestProducer requestProducer = this.requestProducerRef.get();
    Asserts.check(requestProducer != null, "Inconsistent state: request producer is null");
    requestProducer.produceContent(encoder, ioctrl);
    if (encoder.isCompleted()) {
        requestProducer.resetRequest();
    }
}