T
- Type of the value that will be returned by the associated
Future
public abstract class AsyncCompletionHandler<T> extends java.lang.Object implements AsyncHandler<T>, ProgressAsyncHandler<T>
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
AsyncHandler.State
Constructor and Description |
---|
AsyncCompletionHandler() |
Modifier and Type | Method and Description |
---|---|
AsyncHandler.State |
onBodyPartReceived(HttpResponseBodyPart content)
Invoked as soon as some response body part are received.
|
T |
onCompleted()
Invoked once the HTTP response processing is finished.
|
abstract T |
onCompleted(Response response)
Invoked once the HTTP response processing is finished.
|
AsyncHandler.State |
onContentWriteProgress(long amount,
long current,
long total)
Invoked when the I/O operation associated with the
Request body as
been progressed. |
AsyncHandler.State |
onContentWritten()
Invoked when the content (a
File , String or
InputStream has been fully written on the I/O socket. |
AsyncHandler.State |
onHeadersReceived(io.netty.handler.codec.http.HttpHeaders headers)
Invoked as soon as the HTTP headers have been received.
|
AsyncHandler.State |
onHeadersWritten()
Invoked when the HTTP headers have been fully written on the I/O socket.
|
AsyncHandler.State |
onStatusReceived(HttpResponseStatus status)
Invoked as soon as the HTTP status line has been received
|
void |
onThrowable(java.lang.Throwable t)
Invoked when an unexpected exception occurs during the processing of the response.
|
AsyncHandler.State |
onTrailingHeadersReceived(io.netty.handler.codec.http.HttpHeaders headers)
Invoked when trailing headers have been received.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onConnectionOffer, onConnectionPoolAttempt, onConnectionPooled, onHostnameResolutionAttempt, onHostnameResolutionFailure, onHostnameResolutionSuccess, onRequestSend, onRetry, onTcpConnectAttempt, onTcpConnectFailure, onTcpConnectSuccess, onTlsHandshakeAttempt, onTlsHandshakeFailure, onTlsHandshakeSuccess
public AsyncHandler.State onStatusReceived(HttpResponseStatus status) throws java.lang.Exception
AsyncHandler
onStatusReceived
in interface AsyncHandler<T>
status
- the status code and test of the responseAsyncHandler.State
telling to CONTINUE or ABORT the current processing.java.lang.Exception
- if something wrong happenspublic AsyncHandler.State onHeadersReceived(io.netty.handler.codec.http.HttpHeaders headers) throws java.lang.Exception
AsyncHandler
onHeadersReceived
in interface AsyncHandler<T>
headers
- the HTTP headers.AsyncHandler.State
telling to CONTINUE or ABORT the current processing.java.lang.Exception
- if something wrong happenspublic AsyncHandler.State onBodyPartReceived(HttpResponseBodyPart content) throws java.lang.Exception
AsyncHandler
onBodyPartReceived
in interface AsyncHandler<T>
content
- response's body part.AsyncHandler.State
telling to CONTINUE or ABORT the current processing. Aborting will also close the connection.java.lang.Exception
- if something wrong happenspublic AsyncHandler.State onTrailingHeadersReceived(io.netty.handler.codec.http.HttpHeaders headers) throws java.lang.Exception
AsyncHandler
onTrailingHeadersReceived
in interface AsyncHandler<T>
headers
- the trailing HTTP headers.AsyncHandler.State
telling to CONTINUE or ABORT the current processing.java.lang.Exception
- if something wrong happenspublic final T onCompleted() throws java.lang.Exception
AsyncHandler
onCompleted
in interface AsyncHandler<T>
Future
java.lang.Exception
- if something wrong happenspublic void onThrowable(java.lang.Throwable t)
AsyncHandler
onThrowable
in interface AsyncHandler<T>
t
- a Throwable
public abstract T onCompleted(Response response) throws java.lang.Exception
response
- The Response
Future
java.lang.Exception
- if something wrong happenspublic AsyncHandler.State onHeadersWritten()
onHeadersWritten
in interface ProgressAsyncHandler<T>
AsyncHandler.State
telling to CONTINUE
or ABORT the current processing.public AsyncHandler.State onContentWritten()
File
, String
or
InputStream
has been fully written on the I/O socket.onContentWritten
in interface ProgressAsyncHandler<T>
AsyncHandler.State
telling to CONTINUE
or ABORT the current processing.public AsyncHandler.State onContentWriteProgress(long amount, long current, long total)
Request
body as
been progressed.onContentWriteProgress
in interface ProgressAsyncHandler<T>
amount
- The amount of bytes to transfercurrent
- The amount of bytes transferredtotal
- The total number of bytes transferredAsyncHandler.State
telling to CONTINUE
or ABORT the current processing.Copyright © 2017. All Rights Reserved.