Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.http.nio.protocol
Class BasicAsyncResponseConsumer

    java.lang.Object
      org.apache.http.nio.protocol.AbstractAsyncResponseConsumer<HttpResponse>
          org.apache.http.nio.protocol.BasicAsyncResponseConsumer

All Implemented Interfaces:
  Closeable, Cancellable, HttpAsyncResponseConsumer<HttpResponse>

    public class BasicAsyncResponseConsumer

extends AbstractAsyncResponseConsumer<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 Summary
`BasicAsyncResponseConsumer()`

Method Summary
`protected HttpResponse` | `buildResult(HttpContext context)` Invoked to generate a result object from the received HTTP response message.
`protected void` | `onContentReceived(ContentDecoder decoder, IOControl ioControl)` Invoked to process a chunk of content from the `ContentDecoder`.
`protected void` | `onEntityEnclosed(HttpEntity entity, ContentType contentType)` Invoked if the response message encloses a content entity.
`protected void` | `onResponseReceived(HttpResponse response)` Invoked when a HTTP response message is received.
`protected void` | `releaseResources()` Invoked to release all system resources currently allocated.

Methods inherited from class org.apache.http.nio.protocol.AbstractAsyncResponseConsumer
`cancel, close, consumeContent, failed, getContentType, getException, getResult, isDone, onClose, responseCompleted, responseReceived`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### BasicAsyncResponseConsumer

    public BasicAsyncResponseConsumer()

Method Detail

### onResponseReceived

    protected void onResponseReceived(HttpResponse response)
                               throws IOException

  Description copied from class: `AbstractAsyncResponseConsumer`
  Invoked when a HTTP response message is received. Please note that the `AbstractAsyncResponseConsumer.onContentReceived(ContentDecoder, IOControl)` method will be invoked only if the response messages has a content entity enclosed.

  Specified by:
    `onResponseReceived` in class `AbstractAsyncResponseConsumer<HttpResponse>`
  Parameters:
    `response` - HTTP response message.
  Throws:
    `IOException` - in case of an I/O error

### onEntityEnclosed

    protected void onEntityEnclosed(HttpEntity entity,
                                    ContentType contentType)
                             throws IOException

  Description copied from class: `AbstractAsyncResponseConsumer`
  Invoked if the response message encloses a content entity.

  Specified by:
    `onEntityEnclosed` in class `AbstractAsyncResponseConsumer<HttpResponse>`
  Parameters:
    `entity` - HTTP entity
    `contentType` - expected content type.
  Throws:
    `IOException` - in case of an I/O error

### onContentReceived

    protected void onContentReceived(ContentDecoder decoder,
                                     IOControl ioControl)
                              throws 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<HttpResponse>`
  Parameters:
    `decoder` - content decoder.
    `ioControl` - I/O control of the underlying connection.
  Throws:
    `IOException` - in case of an I/O error

### releaseResources

    protected void releaseResources()

  Description copied from class: `AbstractAsyncResponseConsumer`
  Invoked to release all system resources currently allocated.

  Specified by:
    `releaseResources` in class `AbstractAsyncResponseConsumer<HttpResponse>`

### buildResult

    protected HttpResponse buildResult(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<HttpResponse>`
  Parameters:
    `context` - HTTP context.
  Returns:
    result of the response processing.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.