Class BasicAsyncResponseConsumer

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, org.apache.http.concurrent.Cancellable, HttpAsyncResponseConsumer<org.apache.http.HttpResponse>

    public class BasicAsyncResponseConsumer
    extends AbstractAsyncResponseConsumer<org.apache.http.HttpResponse>
    Basic implementation of HttpAsyncResponseConsumer. Please note that this consumer buffers response content in memory and should be used for relatively small response messages.
    Since:
    4.2
    • Constructor Detail

      • BasicAsyncResponseConsumer

        public BasicAsyncResponseConsumer()
    • Method Detail

      • onEntityEnclosed

        protected void onEntityEnclosed​(org.apache.http.HttpEntity entity,
                                        org.apache.http.entity.ContentType contentType)
                                 throws java.io.IOException
        Description copied from class: AbstractAsyncResponseConsumer
        Invoked if the response message encloses a content entity.
        Specified by:
        onEntityEnclosed in class AbstractAsyncResponseConsumer<org.apache.http.HttpResponse>
        Parameters:
        entity - HTTP entity
        contentType - expected content type.
        Throws:
        java.io.IOException - in case of an I/O error
      • onContentReceived

        protected void onContentReceived​(ContentDecoder decoder,
                                         IOControl ioControl)
                                  throws java.io.IOException
        Description copied from class: AbstractAsyncResponseConsumer
        Invoked to process a chunk of content from the ContentDecoder. The IOControl interface can be used to suspend input events if the consumer is temporarily unable to consume more content.

        The consumer can use the ContentDecoder.isCompleted() method to find out whether or not the message content has been fully consumed.

        Specified by:
        onContentReceived in class AbstractAsyncResponseConsumer<org.apache.http.HttpResponse>
        Parameters:
        decoder - content decoder.
        ioControl - I/O control of the underlying connection.
        Throws:
        java.io.IOException - in case of an I/O error
      • buildResult

        protected org.apache.http.HttpResponse buildResult​(org.apache.http.protocol.HttpContext context)
        Description copied from class: AbstractAsyncResponseConsumer
        Invoked to generate a result object from the received HTTP response message.
        Specified by:
        buildResult in class AbstractAsyncResponseConsumer<org.apache.http.HttpResponse>
        Parameters:
        context - HTTP context.
        Returns:
        result of the response processing.