|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
A utility class to handle multipart/form-data requests,
the kind of requests that support file uploads. This class emulates the
interface of HttpServletRequest, making it familiar to use.
It uses a "push" model where any incoming files are read and saved directly
to disk in the constructor. If you wish to have more flexibility, e.g.
write the files to a database, use the "pull" model
MultipartParser instead.
This class can receive arbitrarily large files (up to an artificial limit you can set), and fairly efficiently too. It cannot handle nested data (multipart content within multipart content) or internationalized content (such as non Latin-1 filenames).
See the included upload.war for an example of how to use this class.
The full file upload specification is contained in experimental RFC 1867, available at http://www.ietf.org/rfc/rfc1867.txt.
MultipartParser| Method Summary | |
java.lang.String |
getContentType(java.lang.String name)
Returns the content type of the specified file (as supplied by the client browser), or null if the file was not included in the upload. |
java.io.File |
getFile(java.lang.String name)
Returns a File object for the specified file saved on the server's filesystem, or null if the file was not included in the upload. |
java.util.Enumeration |
getFileNames()
Returns the names of all the uploaded files as an Enumeration of Strings. |
java.lang.String |
getFilesystemName(java.lang.String name)
Returns the filesystem name of the specified file, or null if the file was not included in the upload. |
java.lang.String |
getParameter(java.lang.String name)
Returns the value of the named parameter as a String, or null if the parameter was not sent or was sent without a value. |
java.util.Enumeration |
getParameterNames()
Returns the names of all the parameters as an Enumeration of Strings. |
java.lang.String[] |
getParameterValues(java.lang.String name)
Returns the values of the named parameter as a String array, or null if the parameter was not sent. |
| Method Detail |
public java.util.Enumeration getParameterNames()
public java.util.Enumeration getFileNames()
public java.lang.String getParameter(java.lang.String name)
name - the parameter name.
public java.lang.String[] getParameterValues(java.lang.String name)
name - the parameter name.
public java.lang.String getFilesystemName(java.lang.String name)
name - the file name.
public java.lang.String getContentType(java.lang.String name)
name - the file name.
public java.io.File getFile(java.lang.String name)
name - the file name.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||