Class ResumableAsyncHandler

  • All Implemented Interfaces:
    AsyncHandler<Response>

    public class ResumableAsyncHandler
    extends Object
    implements AsyncHandler<Response>
    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 occurred. This prevents having to download the entire file again. It's the responsibility of the ResumableAsyncHandler to track how many bytes has been transferred and to properly adjust the file's write position.
    In case of a JVM crash/shutdown, you can create an instance of this class and pass the last valid bytes position.

    Beware that it registers a shutdown hook, that will cause a ClassLoader leak when used in an appserver and only redeploying the application.