Package org.eclipse.rap.fileupload
Class FileUploadHandler
java.lang.Object
org.eclipse.rap.fileupload.FileUploadHandler
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 Summary
ConstructorDescriptionFileUploadHandler
(FileUploadReceiver receiver) Constructs a file upload handler that is associated with the given receiver. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addUploadListener
(FileUploadListener listener) Adds a the given file upload listener to the collection of listeners who will be notified when a file upload proceeds.void
dispose()
Closes and de-registers the upload handler.long
Returns the maximum file size in bytes allowed to be uploaded for this handler.Returns the file upload receiver that is associated with this file upload handler.long
Returns the maximum upload duration.Returns the upload URL to which a file can be uploaded.void
removeUploadListener
(FileUploadListener listener) Removes the given file upload listener from the collection of listeners who will be notified when a file upload proceeds.void
setMaxFileSize
(long maxFileSize) Sets the maximum file size in bytes allowed to be uploaded for this handler.void
setUploadTimeLimit
(long timeLimit) Sets the maximum upload duration in milliseconds.
-
Constructor Details
-
FileUploadHandler
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 benull
-
-
Method Details
-
getUploadUrl
Returns the upload URL to which a file can be uploaded.- Returns:
- the encoded upload URL
-
getReceiver
Returns the file upload receiver that is associated with this file upload handler.- Returns:
- the associated receiver
-
addUploadListener
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 benull
- See Also:
-
removeUploadListener
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 benull
- 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:
-