Class AsyncResponseHandler<T>
- java.lang.Object
-
- software.amazon.awssdk.core.internal.http.async.AsyncResponseHandler<T>
-
- Type Parameters:
T- Type that the response handler produces.
- All Implemented Interfaces:
TransformingAsyncResponseHandler<T>,SdkAsyncHttpResponseHandler
@SdkInternalApi public final class AsyncResponseHandler<T> extends Object implements TransformingAsyncResponseHandler<T>
Response handler for asynchronous non-streaming operations.Adapts an
HttpResponseHandlerto the asynchronousTransformingAsyncResponseHandler. Buffers all content into aByteArrayInputStreamthen invokes theHttpResponseHandler.handle(software.amazon.awssdk.http.SdkHttpFullResponse, software.amazon.awssdk.core.interceptor.ExecutionAttributes)method.
-
-
Constructor Summary
Constructors Constructor Description AsyncResponseHandler(HttpResponseHandler<T> responseHandler, Function<SdkHttpFullResponse,SdkHttpFullResponse> crc32Validator, ExecutionAttributes executionAttributes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonError(Throwable err)voidonHeaders(SdkHttpResponse response)voidonStream(org.reactivestreams.Publisher<ByteBuffer> publisher)CompletableFuture<T>prepare()Return the future holding the transformed response.
-
-
-
Constructor Detail
-
AsyncResponseHandler
public AsyncResponseHandler(HttpResponseHandler<T> responseHandler, Function<SdkHttpFullResponse,SdkHttpFullResponse> crc32Validator, ExecutionAttributes executionAttributes)
-
-
Method Detail
-
onHeaders
public void onHeaders(SdkHttpResponse response)
- Specified by:
onHeadersin interfaceSdkAsyncHttpResponseHandler
-
onStream
public void onStream(org.reactivestreams.Publisher<ByteBuffer> publisher)
- Specified by:
onStreamin interfaceSdkAsyncHttpResponseHandler
-
onError
public void onError(Throwable err)
- Specified by:
onErrorin interfaceSdkAsyncHttpResponseHandler
-
prepare
public CompletableFuture<T> 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<T>- Returns:
- The future holding the transformed response.
-
-