Interface SdkHttpResponseHandler<T>

Type Parameters:
T - Type of result returned in complete(). May be Void.

public interface SdkHttpResponseHandler<T>
Responsible for handling asynchronous http responses
  • Method Summary

    Modifier and Type
    Method
    Description
    Called when all parts of the response have been received.
    void
    Called when an exception occurs during the request/response.
    void
    Called when the initial response with headers is received.
    void
    onStream(org.reactivestreams.Publisher<ByteBuffer> publisher)
    Called when the HTTP client is ready to start sending data to the response handler.
  • Method Details

    • headersReceived

      void headersReceived(SdkHttpResponse response)
      Called when the initial response with headers is received.
      Parameters:
      response - the SdkHttpResponse
    • onStream

      void onStream(org.reactivestreams.Publisher<ByteBuffer> publisher)
      Called when the HTTP client is ready to start sending data to the response handler. Implementations must subscribe to the Publisher and request data via a Subscription as they can handle it.

      If at any time the subscriber wishes to stop receiving data, it may call Subscription.cancel(). This will be treated as a failure of the response and the exceptionOccurred(Throwable) callback will be invoked.

    • exceptionOccurred

      void exceptionOccurred(Throwable throwable)
      Called when an exception occurs during the request/response. This is a terminal method call, no other method invocations should be expected on the SdkHttpResponseHandler after this point.
      Parameters:
      throwable - the exception that occurred.
    • complete

      T complete()
      Called when all parts of the response have been received. This is a terminal method call, no other method invocations should be expected on the SdkHttpResponseHandler after this point.
      Returns:
      Transformed result.