T
- Type that the response handler produces.public final class SyncResponseHandlerAdapter<T> extends Object implements TransformingAsyncResponseHandler<T>
HttpResponseHandler
to the asynchronous SdkHttpResponseHandler
. Buffers
all content into a ByteArrayInputStream
then invokes the HttpResponseHandler.handle(software.amazon.awssdk.http.SdkHttpFullResponse, software.amazon.awssdk.core.interceptor.ExecutionAttributes)
method.Constructor and Description |
---|
SyncResponseHandlerAdapter(HttpResponseHandler<T> responseHandler,
Function<SdkHttpFullResponse,SdkHttpFullResponse> crc32Validator,
ExecutionAttributes executionAttributes) |
Modifier and Type | Method and Description |
---|---|
void |
onError(Throwable err)
Called when there is an error making the request or receiving the response.
|
void |
onHeaders(SdkHttpResponse response)
Called when the headers have been received.
|
void |
onStream(org.reactivestreams.Publisher<ByteBuffer> publisher)
Called when the streaming body is ready.
|
CompletableFuture<T> |
prepare()
Return the future holding the transformed response.
|
public SyncResponseHandlerAdapter(HttpResponseHandler<T> responseHandler, Function<SdkHttpFullResponse,SdkHttpFullResponse> crc32Validator, ExecutionAttributes executionAttributes)
public void onHeaders(SdkHttpResponse response)
SdkAsyncHttpResponseHandler
onHeaders
in interface SdkAsyncHttpResponseHandler
response
- The headers.public void onStream(org.reactivestreams.Publisher<ByteBuffer> publisher)
SdkAsyncHttpResponseHandler
This method is always called. If the response does not have a body, then the publisher will complete the subscription without signalling any elements.
onStream
in interface SdkAsyncHttpResponseHandler
publisher
- The streaming body.public void onError(Throwable err)
SdkAsyncHttpResponseHandler
Subscriber
.onError
in interface SdkAsyncHttpResponseHandler
err
- The error.public CompletableFuture<T> prepare()
TransformingAsyncResponseHandler
This method is guaranteed to be called before the request is executed, and before SdkAsyncHttpResponseHandler.onHeaders(software.amazon.awssdk.http.SdkHttpResponse)
is signaled.
prepare
in interface TransformingAsyncResponseHandler<T>
Copyright © 2017 Amazon Web Services, Inc. All Rights Reserved.