Class BasicAsyncRequestConsumer

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, HttpAsyncRequestConsumer<org.apache.http.HttpRequest>

    public class BasicAsyncRequestConsumer
    extends AbstractAsyncRequestConsumer<org.apache.http.HttpRequest>
    Basic implementation of HttpAsyncRequestConsumer. Please note that this consumer buffers request content in memory and should be used for relatively small request messages.
    Since:
    4.2
    • Constructor Detail

      • BasicAsyncRequestConsumer

        public BasicAsyncRequestConsumer()
    • 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: AbstractAsyncRequestConsumer
        Invoked if the request message encloses a content entity.
        Specified by:
        onEntityEnclosed in class AbstractAsyncRequestConsumer<org.apache.http.HttpRequest>
        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: AbstractAsyncRequestConsumer
        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 AbstractAsyncRequestConsumer<org.apache.http.HttpRequest>
        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.HttpRequest buildResult​(org.apache.http.protocol.HttpContext context)
        Description copied from class: AbstractAsyncRequestConsumer
        Invoked to generate a result object from the received HTTP request message.
        Specified by:
        buildResult in class AbstractAsyncRequestConsumer<org.apache.http.HttpRequest>
        Parameters:
        context - HTTP context.
        Returns:
        result of the request processing.