Class CombinedResponseAsyncHttpResponseHandler<OutputT>
java.lang.Object
software.amazon.awssdk.core.internal.http.async.CombinedResponseAsyncHttpResponseHandler<OutputT>
- All Implemented Interfaces:
TransformingAsyncResponseHandler<Response<OutputT>>,SdkAsyncHttpResponseHandler
public final class CombinedResponseAsyncHttpResponseHandler<OutputT>
extends Object
implements TransformingAsyncResponseHandler<Response<OutputT>>
Detects whether the response succeeded or failed by just checking the HTTP status and delegates to appropriate
async response handler. Can be used with streaming or non-streaming requests.
-
Constructor Summary
ConstructorsConstructorDescriptionCombinedResponseAsyncHttpResponseHandler(TransformingAsyncResponseHandler<OutputT> successResponseHandler, TransformingAsyncResponseHandler<? extends SdkException> errorResponseHandler) -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled when there is an error making the request or receiving the response.voidonHeaders(SdkHttpResponse response) Called when the headers have been received.voidonStream(org.reactivestreams.Publisher<ByteBuffer> publisher) Called when the streaming body is ready.prepare()Return the future holding the transformed response.
-
Constructor Details
-
CombinedResponseAsyncHttpResponseHandler
public CombinedResponseAsyncHttpResponseHandler(TransformingAsyncResponseHandler<OutputT> successResponseHandler, TransformingAsyncResponseHandler<? extends SdkException> errorResponseHandler)
-
-
Method Details
-
onHeaders
Description copied from interface:SdkAsyncHttpResponseHandlerCalled when the headers have been received.- Specified by:
onHeadersin interfaceSdkAsyncHttpResponseHandler- Parameters:
response- The headers.
-
onError
Description copied from interface:SdkAsyncHttpResponseHandlerCalled when there is an error making the request or receiving the response. If the error is encountered while streaming the body, then the error is also delivered to theSubscriber.- Specified by:
onErrorin interfaceSdkAsyncHttpResponseHandler- Parameters:
error- The error.
-
onStream
Description copied from interface:SdkAsyncHttpResponseHandlerCalled when the streaming body is ready.This method is always called. If the response does not have a body, then the publisher will complete the subscription without signalling any elements.
- Specified by:
onStreamin interfaceSdkAsyncHttpResponseHandler- Parameters:
publisher- The streaming body.
-
prepare
Description copied from interface:TransformingAsyncResponseHandlerReturn the future holding the transformed response.This method is guaranteed to be called before the request is executed, and before
SdkAsyncHttpResponseHandler.onHeaders(software.amazon.awssdk.http.SdkHttpResponse)is signaled.- Specified by:
preparein interfaceTransformingAsyncResponseHandler<OutputT>- Returns:
- The future holding the transformed response.
-