public abstract class DefaultFileUploadThread extends Thread implements FileUploadThread
FileUploadThread
class. It's an abstract class that contains the default
implementation for the FileUploadThread
interface. startRequest(long, boolean, int, boolean)
: start of the
UploadRequest. Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
protected String |
responseBody
The response message from the application.
|
protected String |
responseMsg
The full response message from the server, if any.
|
protected UploadPolicy |
uploadPolicy
The upload policy contains all parameters needed to define the way files should be uploaded, including the URL.
|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
DefaultFileUploadThread(String threadName,
BlockingQueue<UploadFilePacket> packetQueue,
UploadPolicy uploadPolicy,
FileUploadManagerThread fileUploadManagerThread)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the connection to the server and releases resources.
|
BlockingQueue<UploadFilePacket> |
getPacketQueue() |
String |
getResponseBody()
Return the the body for the server response.
|
String |
getResponseMsg()
Get the server Output.
|
String |
normalizeCRLF(String s)
Replace single \r and \n by uniform end of line characters (CRLF).
|
String |
quoteCRLF(String s)
Replace \r and \n by correctly displayed end of line characters.
|
void |
run()
This method waits for a packet on the packetQueue.
|
void |
setFileUploadThreadManager(FileUploadManagerThread fileUploadManagerThread)
Changes the FileUploadManagerThread.
|
activeCount, checkAccess, clone, 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
protected UploadPolicy uploadPolicy
protected String responseMsg
protected String responseBody
public DefaultFileUploadThread(String threadName, BlockingQueue<UploadFilePacket> packetQueue, UploadPolicy uploadPolicy, FileUploadManagerThread fileUploadManagerThread)
threadName
- The name of the thread, that will be displayed in the debugger and in the logs.packetQueue
- The queue from wich packets to upload are available.uploadPolicy
- The upload policy to be applied.fileUploadManagerThread
- The thread that is managing the upload.public String getResponseBody()
public String getResponseMsg()
getResponseMsg
in interface FileUploadThread
public BlockingQueue<UploadFilePacket> getPacketQueue()
getPacketQueue
in interface FileUploadThread
public final void run()
public void close()
FileUploadThread
close
in interface FileUploadThread
FileUploadThread.close()
public final String normalizeCRLF(String s)
s
- The original stringpublic final String quoteCRLF(String s)
s
- The original stringpublic void setFileUploadThreadManager(FileUploadManagerThread fileUploadManagerThread) throws JUploadException
setFileUploadThreadManager
in interface FileUploadThread
JUploadException
FileUploadManagerThread
Copyright © 2015. All rights reserved.