|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ning.http.client.resumable.ResumableAsyncHandler<T>
public class ResumableAsyncHandler<T>
An AsyncHandler
which support resumable download, e.g when used with an ResumableIOExceptionFilter
,
this handler can resume the download operation at the point it was before the interruption occured. This prevent having to
download the entire file again. It's the responsibility of the TransferListener
to track how many bytes has been transferred and to properly adjust the file's write position.
Nested Class Summary | |
---|---|
static interface |
ResumableAsyncHandler.ResumableProcessor
An interface to implement in order to manage the way the incomplete file management are handled. |
Nested classes/interfaces inherited from interface com.ning.http.client.AsyncHandler |
---|
AsyncHandler.STATE |
Constructor Summary | |
---|---|
ResumableAsyncHandler()
|
|
ResumableAsyncHandler(AsyncHandler<T> decoratedAsyncHandler)
|
|
ResumableAsyncHandler(boolean accumulateBody)
|
|
ResumableAsyncHandler(long byteTransferred)
|
|
ResumableAsyncHandler(long byteTransferred,
AsyncHandler<T> decoratedAsyncHandler)
|
|
ResumableAsyncHandler(ResumableAsyncHandler.ResumableProcessor resumableProcessor)
|
|
ResumableAsyncHandler(ResumableAsyncHandler.ResumableProcessor resumableProcessor,
boolean accumulateBody)
|
Method Summary | |
---|---|
Request |
adjustRequestRange(Request request)
Invoke this API if you want to set the Range header on your Request based on the last valid bytes
position. |
AsyncHandler.STATE |
onBodyPartReceived(HttpResponseBodyPart bodyPart)
Invoked as soon as some response body part are received. |
T |
onCompleted()
Invoked once the HTTP response processing is finished. |
AsyncHandler.STATE |
onHeadersReceived(HttpResponseHeaders headers)
Invoked as soon as the HTTP headers has been received. |
AsyncHandler.STATE |
onStatusReceived(HttpResponseStatus status)
Invoked as soon as the HTTP status line has been received |
void |
onThrowable(Throwable t)
Invoked when an unexpected exception occurs during the processing of the response. |
ResumableAsyncHandler |
setResumableListener(ResumableListener resumableListener)
Set a ResumableListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ResumableAsyncHandler(long byteTransferred)
public ResumableAsyncHandler(boolean accumulateBody)
public ResumableAsyncHandler()
public ResumableAsyncHandler(AsyncHandler<T> decoratedAsyncHandler)
public ResumableAsyncHandler(long byteTransferred, AsyncHandler<T> decoratedAsyncHandler)
public ResumableAsyncHandler(ResumableAsyncHandler.ResumableProcessor resumableProcessor)
public ResumableAsyncHandler(ResumableAsyncHandler.ResumableProcessor resumableProcessor, boolean accumulateBody)
Method Detail |
---|
public AsyncHandler.STATE onStatusReceived(HttpResponseStatus status) throws Exception
onStatusReceived
in interface AsyncHandler<T>
status
- the status code and test of the response
AsyncHandler.STATE
telling to CONTINUE or ABORT the current processing.
Exception
- if something wrong happenspublic void onThrowable(Throwable t)
onThrowable
in interface AsyncHandler<T>
t
- a Throwable
public AsyncHandler.STATE onBodyPartReceived(HttpResponseBodyPart bodyPart) throws Exception
onBodyPartReceived
in interface AsyncHandler<T>
bodyPart
- response's body part.
AsyncHandler.STATE
telling to CONTINUE or ABORT the current processing.
Exception
- if something wrong happenspublic T onCompleted() throws Exception
onCompleted
in interface AsyncHandler<T>
Future
Exception
- if something wrong happenspublic AsyncHandler.STATE onHeadersReceived(HttpResponseHeaders headers) throws Exception
onHeadersReceived
in interface AsyncHandler<T>
headers
- the HTTP headers.
AsyncHandler.STATE
telling to CONTINUE or ABORT the current processing.
Exception
- if something wrong happenspublic Request adjustRequestRange(Request request)
Request
based on the last valid bytes
position.
request
- Request
Request
with the Range header properly set.public ResumableAsyncHandler setResumableListener(ResumableListener resumableListener)
ResumableListener
resumableListener
- a ResumableListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |