ResponseT - Response POJO type.ReturnT - Tranformation result type. Returned by complete()SdkHttpResponseHandler<ReturnT>public class UnmarshallingAsyncResponseHandler<ResponseT,ReturnT> extends Object implements SdkHttpResponseHandler<ReturnT>
AsyncResponseHandler to a SdkHttpResponseHandler by first performing unmarshalling
on the initial response (headers/status code).| Constructor | Description |
|---|---|
UnmarshallingAsyncResponseHandler(AsyncResponseHandler<ResponseT,ReturnT> asyncResponseHandler,
FunctionalUtils.UnsafeFunction<SdkHttpResponse,ResponseT> unmarshaller) |
| Modifier and Type | Method | Description |
|---|---|---|
ReturnT |
complete() |
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.
|
public UnmarshallingAsyncResponseHandler(AsyncResponseHandler<ResponseT,ReturnT> asyncResponseHandler, FunctionalUtils.UnsafeFunction<SdkHttpResponse,ResponseT> unmarshaller)
asyncResponseHandler - Response handler being adapted.unmarshaller - Unmarshaller that takes an SdkHttpResponse and returns the unmarshalled POJO.public void headersReceived(SdkHttpResponse response)
SdkHttpResponseHandlerheadersReceived in interface SdkHttpResponseHandler<ResponseT>response - the SdkHttpResponsepublic void onStream(org.reactivestreams.Publisher<ByteBuffer> publisher)
SdkHttpResponseHandlerPublisher 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 SdkHttpResponseHandler.exceptionOccurred(Throwable) callback will be invoked.
onStream in interface SdkHttpResponseHandler<ResponseT>public void exceptionOccurred(Throwable throwable)
SdkHttpResponseHandlerexceptionOccurred in interface SdkHttpResponseHandler<ResponseT>throwable - the exception that occurred.public ReturnT complete()
SdkHttpResponseHandlercomplete in interface SdkHttpResponseHandler<ResponseT>Copyright © 2017 Amazon Web Services, Inc. All Rights Reserved.