Interface SdkHttpResponseHandler<T>
- Type Parameters:
T- Type of result returned incomplete(). May beVoid.
public interface SdkHttpResponseHandler<T>
Responsible for handling asynchronous http responses
-
Method Summary
Modifier and TypeMethodDescriptioncomplete()Called when all parts of the response have been received.voidexceptionOccurred(Throwable throwable) Called when an exception occurs during the request/response.voidheadersReceived(SdkHttpResponse response) Called when the initial response with headers is received.voidonStream(org.reactivestreams.Publisher<ByteBuffer> publisher) Called when the HTTP client is ready to start sending data to the response handler.
-
Method Details
-
headersReceived
Called when the initial response with headers is received.- Parameters:
response- theSdkHttpResponse
-
onStream
Called when the HTTP client is ready to start sending data to the response handler. Implementations must subscribe to thePublisherand request data via aSubscriptionas 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 theexceptionOccurred(Throwable)callback will be invoked. -
exceptionOccurred
Called when an exception occurs during the request/response. This is a terminal method call, no other method invocations should be expected on theSdkHttpResponseHandlerafter 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 theSdkHttpResponseHandlerafter this point.- Returns:
- Transformed result.
-