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.void
exceptionOccurred
(Throwable throwable) Called when an exception occurs during the request/response.void
headersReceived
(SdkHttpResponse response) 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
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 thePublisher
and request data via aSubscription
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 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 theSdkHttpResponseHandler
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 theSdkHttpResponseHandler
after this point.- Returns:
- Transformed result.
-