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
public final class AsyncResponseHandler<T> extends Object implements TransformingAsyncResponseHandler<T>
Response handler for asynchronous non-streaming operations.Adapts an
HttpResponseHandler
to the asynchronousTransformingAsyncResponseHandler
. Buffers all content into aByteArrayInputStream
then 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 void
onError(Throwable err)
void
onHeaders(SdkHttpResponse response)
void
onStream(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:
onHeaders
in interfaceSdkAsyncHttpResponseHandler
-
onStream
public void onStream(org.reactivestreams.Publisher<ByteBuffer> publisher)
- Specified by:
onStream
in interfaceSdkAsyncHttpResponseHandler
-
onError
public void onError(Throwable err)
- Specified by:
onError
in interfaceSdkAsyncHttpResponseHandler
-
prepare
public CompletableFuture<T> prepare()
Description copied from interface:TransformingAsyncResponseHandler
Return 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:
prepare
in interfaceTransformingAsyncResponseHandler<T>
- Returns:
- The future holding the transformed response.
-
-