Interface ResumableUpload

All Superinterfaces:
ResumableUploadBase

public interface ResumableUpload extends ResumableUploadBase
Implemented on files that can retort upload progress.

You will implement this interface together with UploadProgress interface when you would like to provide one or more of the following features:

  • Pause/resume uploads.
  • Restore broken uploads.
  • Report upload process and create upload progress bars.
  • Upload from AJAX (or other thin-client) applications using POST verb.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    In this method implementation you can delete partially uploaded file.
    long
    Amount of bytes successfully saved to your storage.
    boolean
    Indicates if item will be checked-in by the engine when last chunk of a file is uploaded if item was checked in when upload started.
    long
    The date and time when the last chunk of file was saved in your storage.
    long
    Total file size that is being uploaded.
    void
    setCheckInOnFileComplete(boolean value)
    Shall store value which indicates whether file will be checked in when upload finishes.
  • Method Details

    • cancelUpload

      void cancelUpload() throws LockedException, ServerException
      In this method implementation you can delete partially uploaded file.

      Often during long-continued upload you will keep the old file content to be returned by GET requests and store the new file content in a temporary file (or temporary field in database, etc). To delete this partially uploaded content client can submit CANCELUPLOAD command, the Engine will call this method in this case.

      If the item was automatically checked-out by the Engine when upload started it will be automatically checked-in by the Engine after this call.

      Example Request:

       CANCELUPLOAD /LargeFile.doc HTTP/1.1
       Host: http://server:8580/
       
      Response:
       HTTP/1.1 200 OK
       
      Response:

      Throws:
      LockedException - - this item or its parent was locked and client did not provide lock token.
      ServerException - - in case of an error.
    • getLastChunkSaved

      long getLastChunkSaved() throws ServerException
      The date and time when the last chunk of file was saved in your storage.

      Requested by the Engine during a call to UploadProgress.getUploadProgress().

      Returns:
      Time when last chunk of file was saved.
      Throws:
      ServerException - in case of an error.
    • getBytesUploaded

      long getBytesUploaded() throws ServerException
      Amount of bytes successfully saved to your storage.

      Client will use value returned by this property to restore broken upload. This value shall always reflect number of bytes already stored to persistent medium.

      Requested by the Engine during a call to UploadProgress.getUploadProgress().

      Returns:
      Amount of bytes successfully saved.
      Throws:
      ServerException - in case of an error.
    • getTotalContentLength

      long getTotalContentLength() throws ServerException
      Total file size that is being uploaded.

      This value is passed to File.write(java.io.InputStream, java.lang.String, long, long) method. Usually AJAX/HTML based clients will use value returned by this property to display upload progress.

      Requested by the Engine during a call to UploadProgress.getUploadProgress().

      Returns:
      Total file size in bytes.
      Throws:
      ServerException - in case of an error.
    • getCheckInOnFileComplete

      boolean getCheckInOnFileComplete() throws ServerException
      Indicates if item will be checked-in by the engine when last chunk of a file is uploaded if item was checked in when upload started.
      Returns:
      True if item will be checked in when upload finishes.
      Throws:
      ServerException - in case of an error.
    • setCheckInOnFileComplete

      void setCheckInOnFileComplete(boolean value) throws ServerException
      Shall store value which indicates whether file will be checked in when upload finishes.
      Parameters:
      value - True if item will be checked in when upload finishes.
      Throws:
      ServerException - in case of an error.