|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.cofax.cms.MultipartRequest
A MuliPart form data parser. Parses an input stream and writes out any files found,
making available a hashtable of other url parameters.
Copyright (C)2000 Jason Pell.
Note: restraints have been added to this class so it does not throw errors when trying
to check a key/ value combination where key does not exist. This class also now returns
a hashtable that is populated with filename/ location in addition to any other
HTTPRequest variables that already existed in the querystring.
- Charles Harvey.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Email: [email protected] Url: http://www.geocities.com/SiliconValley/Haven/9778
Field Summary | |
static int |
MAX_READ_BYTES
Prevent a denial of service by defining this, will never read more data. |
static int |
READ_LINE_BLOCK
Defines the number of bytes to read per readLine call. |
Constructor Summary | |
MultipartRequest(java.io.PrintWriter debug,
java.lang.String strContentTypeText,
int intContentLength,
java.io.InputStream in,
java.lang.String strSaveDirectory)
Constructor. |
|
MultipartRequest(java.lang.String strContentTypeText,
int intContentLength,
java.io.InputStream in,
java.lang.String strSaveDirectory)
Constructor. |
Method Summary | |
java.lang.String |
getContentType(java.lang.String strName)
Returns the Content-Type of a file. |
java.io.File |
getFile(java.lang.String strName)
Because the strSaveDirectory you specify is really only the temporary location to stream the files to, we want a way to get at the files contents to put it in the correct location. |
java.util.Enumeration |
getFileParameterNames()
|
long |
getFileSize(java.lang.String strName)
Returns the File Size of a file. |
java.lang.String |
getFileSystemName(java.lang.String strName)
Returns the File System name of a file. |
java.lang.String |
getHtmlTable()
For debugging. |
java.util.Enumeration |
getParameterNames()
An enumeration of all URL Parameters for the current HTTP Request. |
java.lang.String |
getURLParameter(java.lang.String strParameter)
If an error occurs will return null. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int MAX_READ_BYTES
public static final int READ_LINE_BLOCK
Constructor Detail |
public MultipartRequest(java.lang.String strContentTypeText, int intContentLength, java.io.InputStream in, java.lang.String strSaveDirectory) throws java.lang.IllegalArgumentException, java.io.IOException
strContentTypeText
- The "Content-Type" HTTP header value.intContentLength
- The "Content-Length" HTTP header value.in
- The InputStream to read and parse.strSaveDirectory
- The temporary directory to save the file from where they can then be moved to wherever by the
calling process. If you specify null for this parameter, then any files uploaded
will be silently ignored.java.lang.IllegalArgumentException
- If the strContentTypeText does not contain a Content-Type of "multipart/form-data" or the boundary is not found.java.io.IOException
- If the intContentLength is higher than MAX_READ_BYTES or strSaveDirectory is invalid or cannot be written to.MAX_READ_BYTES
public MultipartRequest(java.io.PrintWriter debug, java.lang.String strContentTypeText, int intContentLength, java.io.InputStream in, java.lang.String strSaveDirectory) throws java.lang.IllegalArgumentException, java.io.IOException
debug
- A PrintWriter that can be used for debugging.strContentTypeText
- The "Content-Type" HTTP header value.intContentLength
- The "Content-Length" HTTP header value.in
- The InputStream to read and parse.strSaveDirectory
- The temporary directory to save the file from where they can then be moved to wherever by the
calling process. If you specify null for this parameter, then any files uploaded
will be silently ignored.java.lang.IllegalArgumentException
- If the strContentTypeText does not contain a Content-Type of "multipart/form-data" or the boundary is not found.java.io.IOException
- If the intContentLength is higher than MAX_READ_BYTES or strSaveDirectory is invalid or cannot be written to.MAX_READ_BYTES
Method Detail |
public java.lang.String getURLParameter(java.lang.String strParameter)
public java.util.Enumeration getParameterNames()
public java.util.Enumeration getFileParameterNames()
public java.lang.String getContentType(java.lang.String strName)
public java.io.File getFile(java.lang.String strName)
getFileSize(java.lang.String)
public java.lang.String getFileSystemName(java.lang.String strName)
public long getFileSize(java.lang.String strName)
public java.lang.String getHtmlTable()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |