|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread wjhk.jupload2.upload.DefaultFileUploadThread wjhk.jupload2.upload.FileUploadThreadFTP
public class FileUploadThreadFTP
The FileUploadThreadFTP class is intended to extend the functionality of the
JUpload applet and allow it to handle ftp:// addresses.
Note: this class is not a V4 of the FTP upload. It is named V4, as it
inherits from the FileUploadThread
class.
In order to use it, simply change the postURL argument to the applet to
contain the appropriate ftp:// link. The format is:
ftp://username:password@myhost.com:21/directoryWhere everything but the host is optional. There is another parameter that can be passed to the applet named 'binary' which will set the file transfer mode based on the value. The possible values here are 'true' or 'false'. It was intended to be somewhat intelligent by looking at the file extension and basing the transfer mode on that, however, it was never implemented. Feel free to! Also, there is a 'passive' parameter which also has a value of 'true' or 'false' which sets the connection type to either active or passive mode.
FileUploadThread
class, FileUploadThread
,
DefaultFileUploadThread
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
Pattern |
ftpPattern
This pattern defines the groups and pattern of the ftp syntax. |
Fields inherited from class wjhk.jupload2.upload.DefaultFileUploadThread |
---|
fileUploadManagerThread, packetQueue, responseBody, responseMsg, uploadPolicy |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
FileUploadThreadFTP(UploadPolicy uploadPolicy,
BlockingQueue<UploadFilePacket> packetQueue,
FileUploadManagerThread fileUploadManagerThread)
Creates a new instance. |
Method Summary | |
---|---|
(package private) void |
afterFile(UploadFileData uploadFileData)
Idem as DefaultFileUploadThread.beforeFile(UploadFilePacket, UploadFileData) , but is
called after each file (and each chunks for each file). |
(package private) void |
beforeFile(UploadFilePacket uploadFilePacket,
UploadFileData uploadFileData)
This method is called before sending the bytes corresponding to the file whose index is given in argument. |
(package private) void |
beforeRequest(UploadFilePacket packet)
This method is called before starting of each request. |
(package private) void |
cleanAll()
Clean any used resource, like a 'permanent' connection. |
(package private) void |
cleanRequest()
Clean any used resource of the last executed request. |
(package private) int |
finishRequest()
This method is called at the end of each request. |
(package private) long |
getAdditionnalBytesForUpload(UploadFileData uploadFileData)
This method is called before the upload. |
(package private) OutputStream |
getOutputStream()
Get the output stream where the files should be written for upload. |
(package private) void |
interruptionReceived()
Reaction of the upload thread, when an interruption has been received. |
(package private) void |
startRequest(long contentLength,
boolean bChunkEnabled,
int chunkPart,
boolean bLastChunk)
This method is called for each upload request to the server. |
Methods inherited from class wjhk.jupload2.upload.DefaultFileUploadThread |
---|
close, getPacketQueue, getResponseBody, getResponseMsg, normalizeCRLF, quoteCRLF, run, setFileUploadThreadManager, setResponseBody, setResponseMsg |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface wjhk.jupload2.upload.FileUploadThread |
---|
getState, interrupt, isAlive, join, join, start |
Field Detail |
---|
public final Pattern ftpPattern
Constructor Detail |
---|
public FileUploadThreadFTP(UploadPolicy uploadPolicy, BlockingQueue<UploadFilePacket> packetQueue, FileUploadManagerThread fileUploadManagerThread) throws JUploadException
uploadPolicy
- packetQueue
- The queue from wich packets to upload are available.fileUploadManagerThread
-
JUploadException
IllegalArgumentException
- if any error occurs. message is errorMethod Detail |
---|
void beforeRequest(UploadFilePacket packet) throws JUploadException
DefaultFileUploadThread
DefaultFileUploadThread.packetQueue
queue.
beforeRequest
in class DefaultFileUploadThread
JUploadException
DefaultFileUploadThread.beforeRequest(UploadFilePacket)
void afterFile(UploadFileData uploadFileData)
DefaultFileUploadThread
DefaultFileUploadThread.beforeFile(UploadFilePacket, UploadFileData)
, but is
called after each file (and each chunks for each file).
afterFile
in class DefaultFileUploadThread
uploadFileData
- The file that was just sent.DefaultFileUploadThread.afterFile(UploadFileData)
void beforeFile(UploadFilePacket uploadFilePacket, UploadFileData uploadFileData) throws JUploadException
DefaultFileUploadThread
beforeFile
in class DefaultFileUploadThread
uploadFilePacket
- The bunch of files in the current requestuploadFileData
- The next file that will be sent
JUploadException
DefaultFileUploadThread.beforeFile(UploadFilePacket, UploadFileData)
void cleanAll()
DefaultFileUploadThread
cleanAll
in class DefaultFileUploadThread
DefaultFileUploadThread.cleanAll()
void cleanRequest() throws JUploadException
DefaultFileUploadThread
cleanRequest
in class DefaultFileUploadThread
JUploadException
DefaultFileUploadThread.cleanRequest()
int finishRequest() throws JUploadException
DefaultFileUploadThread
finishRequest
in class DefaultFileUploadThread
JUploadIOException
JUploadException
DefaultFileUploadThread.finishRequest()
long getAdditionnalBytesForUpload(UploadFileData uploadFileData)
DefaultFileUploadThread
FileData.beforeUpload()
method for all files to upload, and
prepares the progressBar bar (if any), with total number of bytes to
upload.
final private void beforeUpload() throws JUploadException { for (int i =
0; i < this.filesToUpload.length &&
!this.fileUploadManager.isUploadStopped(); i++) {
this.filesToUpload[i].beforeUpload(); } }
/** This methods upload overhead for the file number indexFile in the
filesDataParam given to the constructor. For instance, in HTTP, the
upload contains a head and a tail for each files.
getAdditionnalBytesForUpload
in class DefaultFileUploadThread
uploadFileData
- The file whose additional length is asked.
DefaultFileUploadThread.getAdditionnalBytesForUpload(UploadFileData)
OutputStream getOutputStream()
DefaultFileUploadThread
getOutputStream
in class DefaultFileUploadThread
DefaultFileUploadThread.getOutputStream()
void startRequest(long contentLength, boolean bChunkEnabled, int chunkPart, boolean bLastChunk)
DefaultFileUploadThread
DefaultFileUploadThread.getOutputStream()
methods is then
called to know where the uploaded files should be written.
startRequest
in class DefaultFileUploadThread
contentLength
- The total number of bytes for the files (or the
chunk) to upload in this query.bChunkEnabled
- True if this upload is part of a file (can occurs
only if the maxChunkSize applet parameter is set). False
otherwise.chunkPart
- The chunk number. Should be ignored if bChunkEnabled is
false.bLastChunk
- True if in chunk mode, and this upload is the last one.
Should be ignored if bChunkEnabled is false.DefaultFileUploadThread.startRequest(long, boolean, int, boolean)
void interruptionReceived()
interruptionReceived
in class DefaultFileUploadThread
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |