Class FileUploadHandler

java.lang.Object
org.eclipse.rap.fileupload.FileUploadHandler

public class FileUploadHandler extends Object
A file upload handler is used to accept file uploads from a client. After creating a file upload handler, the server will accept file uploads to the URL returned by getUploadUrl(). Upload listeners can be attached to react on progress. When the upload has finished, a FileUploadHandler has to be disposed of by calling its dispose() method.
  • Constructor Details

    • FileUploadHandler

      public FileUploadHandler(FileUploadReceiver receiver)
      Constructs a file upload handler that is associated with the given receiver. The receiver is responsible for reading and processing the uploaded data.
      Parameters:
      receiver - the receiver that should process the uploaded data, must not be null
  • Method Details

    • getUploadUrl

      public String getUploadUrl()
      Returns the upload URL to which a file can be uploaded.
      Returns:
      the encoded upload URL
    • getReceiver

      public FileUploadReceiver getReceiver()
      Returns the file upload receiver that is associated with this file upload handler.
      Returns:
      the associated receiver
    • addUploadListener

      public void addUploadListener(FileUploadListener listener)
      Adds a the given file upload listener to the collection of listeners who will be notified when a file upload proceeds.
      Parameters:
      listener - the file upload listener to add, must not be null
      See Also:
    • removeUploadListener

      public void removeUploadListener(FileUploadListener listener)
      Removes the given file upload listener from the collection of listeners who will be notified when a file upload proceeds.
      Parameters:
      listener - the file upload listener to remove, must not be null
      See Also:
    • dispose

      public void dispose()
      Closes and de-registers the upload handler. After calling this method, no subsequent upload requests for this handler will be accepted anymore. Clients must call this method before discarding the instance of the handler to allow it to be garbage collected.
    • getMaxFileSize

      public long getMaxFileSize()
      Returns the maximum file size in bytes allowed to be uploaded for this handler. The default value of -1, indicates no limit.
      See Also:
    • setMaxFileSize

      public void setMaxFileSize(long maxFileSize)
      Sets the maximum file size in bytes allowed to be uploaded for this handler. A value of -1 indicates no limit.
      See Also:
    • getUploadTimeLimit

      public long getUploadTimeLimit()
      Returns the maximum upload duration. If upload takes longer than this it will be interrupted. The default value of -1, indicates no limit.
      Since:
      3.3
    • setUploadTimeLimit

      public void setUploadTimeLimit(long timeLimit)
      Sets the maximum upload duration in milliseconds. If upload takes longer than this it will be interrupted. The default value of -1, indicates no limit.
      Since:
      3.3
      See Also: