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 Details

    • onReserved

      default void onReserved(IUploadReservation reservation)
      Called once when a reservation has been minted, accepted or refused.
      Parameters:
      reservation - The reservation.
    • onFileStarted

      default void onFileStarted(IUploadReservation reservation, IUploadFile file)
      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

      default void onFilePaused(IUploadReservation reservation, IUploadFile file, String reason)
      Called once when a file enters UploadState.PAUSED: the App called IUploadReservation.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 reason maxPause. 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

      default void onFileResumed(IUploadReservation reservation, IUploadFile file)
      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

      void onFileCompleted(IUploadReservation reservation, IUploadedFile file)
      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

      default void onFileFailed(IUploadReservation reservation, IUploadFile file, String reason)
      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

      default void onFileCancelled(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.
      Parameters:
      reservation - The reservation.
      file - The file.
      reason - The reason, e.g. cancelled, idle, start, disposed, maxPause.
    • onReservationClosed

      default void onReservationClosed(IUploadReservation reservation)
      Called once when every file of the reservation is final.
      Parameters:
      reservation - The reservation.