T
- Type that the response handler produces.SdkHttpResponseHandler<T>
public class SyncResponseHandlerAdapter<T> extends Object implements SdkHttpResponseHandler<T>
HttpResponseHandler
to the asynchronous SdkHttpResponseHandler
. Buffers
all content into a ByteArrayInputStream
then invokes the HttpResponseHandler.handle(HttpResponse)
method.Constructor | Description |
---|---|
SyncResponseHandlerAdapter(HttpResponseHandler<T> responseHandler,
Function<SdkHttpFullResponse,HttpResponse> httpResponseAdapter) |
Modifier and Type | Method | 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)
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
exceptionOccurred
in interface SdkHttpResponseHandler<T>
throwable
- the exception that occurred.public T complete()
SdkHttpResponseHandler
complete
in interface SdkHttpResponseHandler<T>
Copyright © 2017 Amazon Web Services, Inc. All Rights Reserved.