|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mycore.frontend.fileupload.MCRUploadHandler
public abstract class MCRUploadHandler
This class does the server-side of uploading files from a client browser, which runs the upload applet. This is an abstract base class that must be subclassed to implement the storage of files at the server side for miless, MyCoRe or other usages of the upload framework. Every instance of MCRUploadHandler handles one singe upload session with the applet.
MCRUploadHandlerManager| Field Summary | |
|---|---|
protected Logger |
logger
The logger * |
protected String |
uploadID
The unique ID of this upload session * |
protected String |
url
The url where to go after upload is finished. |
| Constructor Summary | |
|---|---|
protected |
MCRUploadHandler()
Creates a new upload handler and registers it at the handler manager * |
| Method Summary | |
|---|---|
boolean |
acceptFile(String path,
String checksum,
long length)
Before the applet sends each file, this method is called to ask if this file should be uploaded and will be accepted by the server. |
void |
cancelUpload()
After the remote user canceled the upload process in the applet, this method is called so that the UploadHandler subclass can finish or cancel work. |
abstract void |
finishUpload()
When the applet finished uploading all files, this method is called so that the UploadHandler subclass can finish work and commit all saved files. |
String |
getID()
Returns the unique ID of this upload session * |
String |
getRedirectURL()
Returns the url where to go after upload is finished * |
abstract long |
receiveFile(String path,
InputStream in,
long length,
String md5)
When the applet uploads a file, this method is called so that the UploadHandler subclass can store the file on the server side. |
abstract void |
startUpload(int numFiles)
Starts the upload session. |
void |
unregister()
When the applet is closed after uploading all files, the servlet calls this method automatically to unregister this upload handler from the UploadHandlerManager. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Logger logger
protected String uploadID
protected String url
| Constructor Detail |
|---|
protected MCRUploadHandler()
| Method Detail |
|---|
public final String getID()
public String getRedirectURL()
public abstract void startUpload(int numFiles)
throws Exception
numFiles - the number of files that the applet will upload
Exception
public boolean acceptFile(String path,
String checksum,
long length)
throws Exception
path - the path and filename of the filechecksum - the MD5 checksum computed at the client applet sidelength - the length of the file in bytes (file size)
Exception
public abstract long receiveFile(String path,
InputStream in,
long length,
String md5)
throws Exception
path - the path and filename of the filein - the inputstream to read the content of the file fromlength - the total file size as number of bytes. This may be 0,
meaning that the file is empty or the file size is not known.md5 - the md5 checksum calculated at the client applet side. This
may be null, meaning that the md5 checksum is not known.
Exception
public abstract void finishUpload()
throws Exception
Exception
public void cancelUpload()
throws Exception
Exceptionpublic void unregister()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||