public class ResponseBodyDeferringAsyncHandler extends Object implements com.ning.http.client.AsyncHandler<com.ning.http.client.Response>
PipedOutputStream to populate the HTTP response as it arrives, propagating an
PipedInputStream as soon as the response headers are parsed.
Because of the internal buffer used to hold the arriving chunks, the response MUST be eventually read or the worker threads
will block waiting to allocate them. Likewise, read/write speed differences could cause issues. The buffer size can be
customized for these reason.
To avoid deadlocks, a hand off to another thread MUST be performed before consuming the response.| Constructor and Description |
|---|
ResponseBodyDeferringAsyncHandler(CompletableFuture<org.mule.runtime.http.api.domain.message.response.HttpResponse> future,
int userDefinedBufferSize) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
closeOut() |
com.ning.http.client.AsyncHandler.STATE |
onBodyPartReceived(com.ning.http.client.HttpResponseBodyPart bodyPart) |
com.ning.http.client.Response |
onCompleted() |
com.ning.http.client.AsyncHandler.STATE |
onHeadersReceived(com.ning.http.client.HttpResponseHeaders headers) |
com.ning.http.client.AsyncHandler.STATE |
onStatusReceived(com.ning.http.client.HttpResponseStatus responseStatus) |
void |
onThrowable(Throwable t) |
public ResponseBodyDeferringAsyncHandler(CompletableFuture<org.mule.runtime.http.api.domain.message.response.HttpResponse> future, int userDefinedBufferSize) throws IOException
IOExceptionpublic void onThrowable(Throwable t)
onThrowable in interface com.ning.http.client.AsyncHandler<com.ning.http.client.Response>public com.ning.http.client.AsyncHandler.STATE onStatusReceived(com.ning.http.client.HttpResponseStatus responseStatus)
throws Exception
onStatusReceived in interface com.ning.http.client.AsyncHandler<com.ning.http.client.Response>Exceptionpublic com.ning.http.client.AsyncHandler.STATE onHeadersReceived(com.ning.http.client.HttpResponseHeaders headers)
throws Exception
onHeadersReceived in interface com.ning.http.client.AsyncHandler<com.ning.http.client.Response>Exceptionpublic com.ning.http.client.AsyncHandler.STATE onBodyPartReceived(com.ning.http.client.HttpResponseBodyPart bodyPart)
throws Exception
onBodyPartReceived in interface com.ning.http.client.AsyncHandler<com.ning.http.client.Response>Exceptionprotected void closeOut()
throws IOException
IOExceptionpublic com.ning.http.client.Response onCompleted()
throws IOException
onCompleted in interface com.ning.http.client.AsyncHandler<com.ning.http.client.Response>IOExceptionCopyright © 2003–2018 MuleSoft, Inc.. All rights reserved.