Package com.ning.http.client
Class AsyncCompletionHandler<T>
java.lang.Object
com.ning.http.client.AsyncCompletionHandler<T>
- Type Parameters:
T- Type of the value that will be returned by the associatedFuture
- All Implemented Interfaces:
AsyncHandler<T>,ProgressAsyncHandler<T>
- Direct Known Subclasses:
AsyncCompletionHandlerBase
public abstract class AsyncCompletionHandler<T>
extends Object
implements AsyncHandler<T>, ProgressAsyncHandler<T>
An
AsyncHandler augmented with an onCompleted(Response) convenience method which gets called
when the Response processing is finished. This class also implement the ProgressAsyncHandler callback,
all doing nothing except returning AsyncHandler.STATE.CONTINUE-
Nested Class Summary
Nested classes/interfaces inherited from interface com.ning.http.client.AsyncHandler
AsyncHandler.STATE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiononBodyPartReceived(HttpResponseBodyPart content) Invoked as soon as some response body part are received.final TInvoked once the HTTP response processing is finished.abstract TonCompleted(Response response) Invoked once the HTTP response processing is finished.Invoked when the content (aFile,StringorFileInputStreamhas been fully written on the I/O socket.onContentWriteProgress(long amount, long current, long total) Invoked when the I/O operation associated with theRequestbody as been progressed.onHeadersReceived(HttpResponseHeaders headers) Invoked as soon as the HTTP headers has been received.Invoked when the content (aFile,StringorFileInputStreamhas been fully written on the I/O socket.onStatusReceived(HttpResponseStatus status) Invoked as soon as the HTTP status line has been receivedvoidInvoked when an unexpected exception occurs during the processing of the response.
-
Constructor Details
-
AsyncCompletionHandler
public AsyncCompletionHandler()
-
-
Method Details
-
onBodyPartReceived
Description copied from interface:AsyncHandlerInvoked as soon as some response body part are received. Could be invoked many times.- Specified by:
onBodyPartReceivedin interfaceAsyncHandler<T>- Parameters:
content- response's body part.- Returns:
- a
AsyncHandler.STATEtelling to CONTINUE or ABORT the current processing. - Throws:
Exception- if something wrong happens
-
onStatusReceived
Description copied from interface:AsyncHandlerInvoked as soon as the HTTP status line has been received- Specified by:
onStatusReceivedin interfaceAsyncHandler<T>- Parameters:
status- the status code and test of the response- Returns:
- a
AsyncHandler.STATEtelling to CONTINUE or ABORT the current processing. - Throws:
Exception- if something wrong happens
-
onHeadersReceived
Description copied from interface:AsyncHandlerInvoked as soon as the HTTP headers has been received. Can potentially be invoked more than once if a broken server sent trailing headers.- Specified by:
onHeadersReceivedin interfaceAsyncHandler<T>- Parameters:
headers- the HTTP headers.- Returns:
- a
AsyncHandler.STATEtelling to CONTINUE or ABORT the current processing. - Throws:
Exception- if something wrong happens
-
onCompleted
Description copied from interface:AsyncHandlerInvoked once the HTTP response processing is finished. Gets always invoked as last callback method.- Specified by:
onCompletedin interfaceAsyncHandler<T>- Returns:
- T Value that will be returned by the associated
Future - Throws:
Exception- if something wrong happens
-
onThrowable
Description copied from interface:AsyncHandlerInvoked when an unexpected exception occurs during the processing of the response. The exception may have been produced by implementation of onXXXReceived method invocation.- Specified by:
onThrowablein interfaceAsyncHandler<T>- Parameters:
t- aThrowable
-
onCompleted
Invoked once the HTTP response processing is finished. -
onHeaderWriteCompleted
Invoked when the content (aFile,StringorFileInputStreamhas been fully written on the I/O socket.- Specified by:
onHeaderWriteCompletedin interfaceProgressAsyncHandler<T>- Returns:
- a
AsyncHandler.STATEtelling to CONTINUE or ABORT the current processing.
-
onContentWriteCompleted
Invoked when the content (aFile,StringorFileInputStreamhas been fully written on the I/O socket.- Specified by:
onContentWriteCompletedin interfaceProgressAsyncHandler<T>- Returns:
- a
AsyncHandler.STATEtelling to CONTINUE or ABORT the current processing.
-
onContentWriteProgress
Invoked when the I/O operation associated with theRequestbody as been progressed.- Specified by:
onContentWriteProgressin interfaceProgressAsyncHandler<T>- Parameters:
amount- The amount of bytes to transfer.current- The amount of bytes transferredtotal- The total number of bytes transferred- Returns:
- a
AsyncHandler.STATEtelling to CONTINUE or ABORT the current processing.
-