Interface IFileUploadListener
public interface IFileUploadListener
Observer of upload reservations, called on the application session's worker thread, never on a servlet thread.
Registered on the service for every reservation of the app session (IFileUploadService.addListener(IFileUploadListener)), or passed to IFileUploadService.reserve(List, IFileUploadListener) to see exactly one reservation. Every method but onFileCompleted(IUploadReservation,IUploadedFile) has an empty default.
- Author:
- Christopher Mindus
Method Summary
Modifier and TypeMethodDescriptiondefault voidonFileCancelled(IUploadReservation reservation, IUploadFile file, String reason) Called once when a file was cancelled by the client, the App, a timeout or disposal; the staged bytes are gone.voidonFileCompleted(IUploadReservation reservation, IUploadedFile file) Called once when a file has been completely received and verified.default voidonFileFailed(IUploadReservation reservation, IUploadFile file, String reason) Called once when a file failed verification or its transfer; the staged bytes are gone.default voidonFilePaused(IUploadReservation reservation, IUploadFile file, String reason) Called once when a file entersUploadState.PAUSED: the App calledIUploadReservation.pause(int,String), or the client sent a pause notice (its page hidden, its network gone).default voidonFileProgress(IUploadReservation reservation, IUploadFile file, long plainBytes, long plainTotal) Called as chunks arrive, at most once per second per file.default voidonFileResumed(IUploadReservation reservation, IUploadFile file) Called once when a paused file may receive chunks again: every party that paused it has resumed it.default voidonFileStarted(IUploadReservation reservation, IUploadFile file) Called when the first chunk of a file has been accepted.default voidonReservationClosed(IUploadReservation reservation) Called once when every file of the reservation is final.default voidonReserved(IUploadReservation reservation) Called once when a reservation has been minted, accepted or refused.
Method Details
onReserved
Called once when a reservation has been minted, accepted or refused.- Parameters:
reservation- The reservation.
onFileStarted
Called when the first chunk of a file has been accepted.- Parameters:
reservation- The reservation.file- The file.
onFileProgress
default void onFileProgress(IUploadReservation reservation, IUploadFile file, long plainBytes, long plainTotal) Called as chunks arrive, at most once per second per file.- Parameters:
reservation- The reservation.file- The file.plainBytes- Uncompressed bytes acknowledged so far.plainTotal- The declared uncompressed size.
onFilePaused
Called once when a file entersUploadState.PAUSED: the App calledIUploadReservation.pause(int,String), or the client sent a pause notice (its page hidden, its network gone). While paused the idle timeout is suspended and the maximum pause time ($upload.maxPause) runs instead; past it the reservation is cancelled with reasonmaxPause. A second party pausing an already paused file gives no event.- Parameters:
reservation- The reservation.file- The file.reason- The reason whoever paused it gave, never null.
onFileResumed
Called once when a paused file may receive chunks again: every party that paused it has resumed it. A chunk arriving from the client on a file only the client had paused is that client's resume.- Parameters:
reservation- The reservation.file- The file.
onFileCompleted
Called once when a file has been completely received and verified. The server owns the staged file until the listener (or a later caller) takes or deletes it.- Parameters:
reservation- The reservation.file- The verified file.
onFileFailed
Called once when a file failed verification or its transfer; the staged bytes are gone.- Parameters:
reservation- The reservation.file- The file.reason- The reason, e.g.typeMismatch,sizeMismatch,corrupt,overCap.
onFileCancelled
Called once when a file was cancelled by the client, the App, a timeout or disposal; the staged bytes are gone.- Parameters:
reservation- The reservation.file- The file.reason- The reason, e.g.cancelled,idle,start,disposed,maxPause.
onReservationClosed
Called once when every file of the reservation is final.- Parameters:
reservation- The reservation.