|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.turbine.util.upload.FileHandler
This class is used to upload files from a client to the server (any types and any number of fields is supported) and download files from the server to the client.
Field Summary | |
private byte[] |
boundary
Deprecated. |
private int |
boundarysize
Deprecated. Place for boundary that separates field data. |
private java.lang.String |
contenttype
Deprecated. |
private static byte[] |
CRLF2
Deprecated. Carriage return - line feed two times. |
private java.lang.String |
fieldname
Deprecated. |
private java.lang.String |
filename
Deprecated. |
private long |
maxdata
Deprecated. Maximum number of bytes accepted, if zero then no limit. |
static java.lang.String |
PARAMETER_NAME_CONTENT_TYPE
Deprecated. |
static java.lang.String |
PARAMETER_NAME_ENCODING
Deprecated. |
static java.lang.String |
PARAMETER_NAME_FILENAME
Deprecated. |
static java.lang.String |
PARAMETER_NAME_FILENAME_SAVED
Deprecated. |
static java.lang.String |
PARAMETER_NAME_FILESIZE
Deprecated. |
private ParameterParser |
pp
Deprecated. |
private byte[] |
readbuffer
Deprecated. |
private static int |
readbuffersize
Deprecated. Buffer for reading/writing data and buffer for storing all data. |
private javax.servlet.http.HttpServletRequest |
req
Deprecated. |
private javax.servlet.http.HttpServletResponse |
res
Deprecated. |
private java.lang.String |
root
Deprecated. |
private byte[] |
storebuffer
Deprecated. |
private int |
storebuffersize
Deprecated. |
private byte[] |
writebuffer
Deprecated. |
private static int |
writebuffersize
Deprecated. Buffer for sending data back to browser. |
Constructor Summary | |
FileHandler(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
ParameterParser pp)
Deprecated. Use TurbineUploadService counterpart FileItem. |
|
FileHandler(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res,
ParameterParser pp,
java.lang.String root)
Deprecated. Use TurbineUploadService counterpart FileItem. |
|
FileHandler(javax.servlet.http.HttpServletRequest req,
ParameterParser pp,
java.lang.String root)
Deprecated. Use TurbineUploadService counterpart FileItem. |
|
FileHandler(RunData data)
Deprecated. Use TurbineUploadService counterpart FileItem. |
|
FileHandler(RunData data,
java.lang.String root)
Deprecated. Use TurbineUploadService counterpart FileItem. |
Method Summary | |
private void |
copyStream(java.io.InputStream ins,
java.io.OutputStream outs)
Deprecated. Copies stream ins to stream outs. |
boolean |
deleteFile(java.lang.String filename)
Deprecated. Use TurbineUploadService counterpart FileItem. |
private int |
findByte(byte b,
int pos)
Deprecated. Finds the first position of B in StoreBuffer beginning with position number Pos, or -1 if not found. |
private int |
findSubArray(byte[] subarray,
int pos)
Deprecated. Finds the first position of SubArray in StoreBuffer beginning with position number Pos, or -1 if not found. |
private java.lang.String |
getChunkAsText(int start,
int end)
Deprecated. Returns the given chunk of StoreBuffer as a String. |
java.lang.String |
getFileRepository()
Deprecated. Use TurbineUploadService counterpart FileItem. |
private void |
getHeaderInfo(int start,
int end)
Deprecated. Finds values of Fieldname and Filename variables from the given chunk of StoreBuffer. |
private java.lang.String |
getRandomName()
Deprecated. Finds random name in the ROOT directory. |
private java.lang.String |
getShortName(java.lang.String fullname)
Deprecated. Cuts short name of a file from its fully qualified name. |
static boolean |
isSimpleForm(javax.servlet.http.HttpServletRequest req)
Deprecated. Use TurbineUploadService counterpart FileItem. |
private void |
readToStoreBuffer(java.io.InputStream instream)
Deprecated. Reads the data from the given inputstream to StoreBuffer. |
void |
saveStream()
Deprecated. Use TurbineUploadService counterpart FileItem. |
void |
setFileRepository(java.lang.String root)
Deprecated. Use TurbineUploadService counterpart FileItem. |
void |
setMaxSize(long size)
Deprecated. Use TurbineUploadService counterpart FileItem. |
private void |
storeChunk(int start,
int end,
java.io.OutputStream outstream)
Deprecated. Writes the given chunk of StoreBuffer to given OutputStream. |
private void |
writeChunks()
Deprecated. Divides StoreBuffer into simple fields and binary fields (files) and writes them to files (simple fields - to a text file, files - to files with random names, providing name mappings in the file for simple fields). |
void |
writeFileToResponse(java.lang.String savedname,
java.lang.String filename,
java.lang.String contenttype)
Deprecated. Use TurbineUploadService counterpart FileItem. |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static java.lang.String PARAMETER_NAME_FILENAME
public static java.lang.String PARAMETER_NAME_FILESIZE
public static java.lang.String PARAMETER_NAME_FILENAME_SAVED
public static java.lang.String PARAMETER_NAME_ENCODING
public static java.lang.String PARAMETER_NAME_CONTENT_TYPE
private static final byte[] CRLF2
private static int readbuffersize
private byte[] readbuffer
private int storebuffersize
private byte[] storebuffer
private static int writebuffersize
private byte[] writebuffer
private long maxdata
private int boundarysize
private byte[] boundary
private java.lang.String fieldname
private java.lang.String filename
private java.lang.String contenttype
private javax.servlet.http.HttpServletRequest req
private javax.servlet.http.HttpServletResponse res
private ParameterParser pp
private java.lang.String root
Constructor Detail |
public FileHandler(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, ParameterParser pp)
req
- An HttpServletRequest.res
- An HttpServletResponse.pp
- A ParameterParser.public FileHandler(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, ParameterParser pp, java.lang.String root)
req
- An HttpServletRequest.res
- An HttpServletResponse.pp
- A ParameterParser.root
- A String.public FileHandler(javax.servlet.http.HttpServletRequest req, ParameterParser pp, java.lang.String root)
req
- An HttpServletRequest.res
- An HttpServletResponse.root
- A String.public FileHandler(RunData data, java.lang.String root)
data
- A Turbine RunData object.root
- A String.public FileHandler(RunData data)
data
- A Turbine RunData object.Method Detail |
public static boolean isSimpleForm(javax.servlet.http.HttpServletRequest req)
req
- An HttpServletRequest.private void copyStream(java.io.InputStream ins, java.io.OutputStream outs) throws java.io.IOException
ins
- An InputStream.outs
- An OutputStream.IOException.
- public void writeFileToResponse(java.lang.String savedname, java.lang.String filename, java.lang.String contenttype) throws java.lang.Exception
savedname
- A String.filename
- A String.contenttype
- A String.Exception,
- a generic exception.private java.lang.String getRandomName()
private java.lang.String getShortName(java.lang.String fullname)
fullname
- Full name of a file.private int findByte(byte b, int pos)
b
- Byte to find.pos
- Position to start from.private int findSubArray(byte[] subarray, int pos)
subarray
- Subarray to find.pos
- Position to start from.private void readToStoreBuffer(java.io.InputStream instream) throws java.io.IOException
instream
- InputStream to use.IOException.
- private void getHeaderInfo(int start, int end)
start
- Starting position in StoreBuffer.end
- Ending position in StoreBuffer.private java.lang.String getChunkAsText(int start, int end)
start
- Starting position in StoreBuffer.end
- Ending position in StoreBuffer.private void storeChunk(int start, int end, java.io.OutputStream outstream) throws java.io.IOException
start
- Starting position in StoreBuffer.end
- Ending position in StoreBuffer.outstream
- OutputStream to write to.IOException.
- private void writeChunks() throws java.io.IOException
IOException.
- public void saveStream() throws javax.servlet.ServletException, java.io.IOException
ServletException.
- IOException.
- public void setFileRepository(java.lang.String root)
root
- A String.public java.lang.String getFileRepository()
public void setMaxSize(long size)
size
- A long.public boolean deleteFile(java.lang.String filename)
filename
- A String.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |