T
- Type that the response handler produces.public final class SyncResponseHandlerAdapter<T> extends Object implements SdkHttpResponseHandler<T>
HttpResponseHandler
to the asynchronous SdkHttpResponseHandler
. Buffers
all content into a ByteArrayInputStream
then invokes the HttpResponseHandler.handle(software.amazon.awssdk.core.http.HttpResponse, software.amazon.awssdk.core.interceptor.ExecutionAttributes)
method.Constructor and Description |
---|
SyncResponseHandlerAdapter(HttpResponseHandler<T> responseHandler,
Function<SdkHttpFullResponse,HttpResponse> httpResponseAdapter,
ExecutionAttributes executionAttributes) |
Modifier and Type | Method and Description |
---|---|
T |
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 SyncResponseHandlerAdapter(HttpResponseHandler<T> responseHandler, Function<SdkHttpFullResponse,HttpResponse> httpResponseAdapter, ExecutionAttributes executionAttributes)
public void headersReceived(SdkHttpResponse response)
SdkHttpResponseHandler
headersReceived
in interface SdkHttpResponseHandler<T>
response
- the SdkHttpResponse
public void onStream(org.reactivestreams.Publisher<ByteBuffer> publisher)
SdkHttpResponseHandler
Publisher
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<T>
public void exceptionOccurred(Throwable throwable)
SdkHttpResponseHandler
SdkHttpResponseHandler
after this point.exceptionOccurred
in interface SdkHttpResponseHandler<T>
throwable
- the exception that occurred.public T complete()
SdkHttpResponseHandler
SdkHttpResponseHandler
after this point.complete
in interface SdkHttpResponseHandler<T>
Copyright © 2017 Amazon Web Services, Inc. All Rights Reserved.