public class CmsUploadListener extends java.lang.Object implements org.apache.commons.fileupload.ProgressListener, java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
protected long |
m_contentLength
The content length of the request (larger than the sum of file sizes).
|
protected java.lang.RuntimeException |
m_exception
Stores the exception if one has been occurred.
|
protected boolean |
m_exceptionTrhown
Signals that there occurred an exception before.
|
| Constructor and Description |
|---|
CmsUploadListener(int requestSize)
The public constructor for the listener.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancelUpload(CmsUploadException e)
Sets the exception that should cancel the upload on the next update.
|
long |
getBytesRead()
Returns the bytes transfered so far.
|
long |
getContentLength()
Returns the content length of the request (larger than the sum of file sizes).
|
java.lang.RuntimeException |
getException()
Returns the exception.
|
CmsUUID |
getId()
Returns the listeners UUID.
|
CmsUploadProgessInfo |
getInfo()
Returns the current progress info of the upload.
|
int |
getItem()
Returns the number of the field, which is currently being read.
|
long |
getPercent()
Returns the percent done of the current upload.
|
boolean |
isCanceled()
Returns
true if the process has been canceled due to an error or by the user. |
boolean |
isFinished()
Returns the finished.
|
void |
setDelay(int delay)
Sets the delay.
|
void |
setFinished(boolean finished)
Sets the finished.
|
java.lang.String |
toString() |
void |
update(long done,
long total,
int item)
Updates the listeners status information and does the following steps:
returns if there was already thrown an exception before
sets the local variables to the current upload state
throws an RuntimeException if it was set in the meanwhile (by another request e.g. user has canceled)
slows down the upload process if it's configured
stops the watcher if the upload has reached more than 100 percent
|
protected long m_contentLength
protected java.lang.RuntimeException m_exception
protected boolean m_exceptionTrhown
public CmsUploadListener(int requestSize)
requestSize - content length of the request (larger than the sum of file sizes)public void cancelUpload(CmsUploadException e)
e - the exceptionpublic long getBytesRead()
public long getContentLength()
public java.lang.RuntimeException getException()
public CmsUploadProgessInfo getInfo()
public int getItem()
public long getPercent()
public boolean isCanceled()
true if the process has been canceled due to an error or by the user.true if the process has been canceled due to an error or by the userpublic boolean isFinished()
public void setDelay(int delay)
delay - the delay to setpublic void setFinished(boolean finished)
finished - the finished to setpublic java.lang.String toString()
toString in class java.lang.ObjectObject.toString()public void update(long done, long total, int item)
update in interface org.apache.commons.fileupload.ProgressListenerProgressListener.update(long, long, int)