public class MPFormData
extends java.lang.Object
Constructor and Description |
---|
MPFormData() |
MPFormData(javax.servlet.http.HttpServletRequest req)
creates a new MPFormData object and gets the request parameters
the MPFormData object is used to retrieve parameters and data from multipart form
submissions.
|
MPFormData(javax.servlet.http.HttpServletRequest req,
int maximumsize)
Alternate constructor that gets it maximum file size from passed
in parameters instead of the doclinks.properties file.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getFileContentType()
gets the file content type.
|
java.lang.String |
getFileName()
gets name of the file contained in the form.
|
java.io.ByteArrayOutputStream |
getFileOutputStream()
gets the output stream containing the file data
|
java.io.ByteArrayOutputStream |
getFileOutputStreamForFile(java.lang.String fileName)
gets the output stream containing the file data for a specific file name
|
java.util.HashMap |
getFileParams()
gets the file parameters of file
|
java.util.HashMap |
getFileParamsForFile(java.lang.String fileName)
gets the file parameters of file
|
java.lang.String |
getFullFileName()
gets FULL name (including path) of the file contained in the form.
|
java.lang.String |
getParameter(java.lang.String param)
gets a request parameter.
|
boolean |
isParam(java.lang.String val)
Returns true if the specified string is a parameter in the request
|
static boolean |
isRequestMultipart(javax.servlet.http.HttpServletRequest req)
checks to see if the content type of the request is "multipart/form-data"
|
void |
processRequest() |
protected void |
readAndKeep(psdi.webclient.system.controller.MPInputStreamHandler in,
java.lang.String boundary,
java.lang.String filename,
java.lang.String contentType)
A utility method that reads a single part of the multipart request
that represents a file, and saves the data in the outputstream
|
protected boolean |
readNextPart(psdi.webclient.system.controller.MPInputStreamHandler in,
java.lang.String boundary)
A utility method that reads an individual part for parameters.
|
protected void |
readRequest(javax.servlet.http.HttpServletRequest request)
the workhorse method that actually parses the request.
|
public MPFormData()
public MPFormData(javax.servlet.http.HttpServletRequest req) throws MXException
MXException
public MPFormData(javax.servlet.http.HttpServletRequest req, int maximumsize) throws MXException
req
- The HttpServletRequestmaximumsize
- The maximum file size in megabytesMXException
public void processRequest() throws MXException
MXException
public static boolean isRequestMultipart(javax.servlet.http.HttpServletRequest req)
HttpServletRequest
- reqpublic java.lang.String getParameter(java.lang.String param)
public boolean isParam(java.lang.String val)
public java.lang.String getFileName()
public java.lang.String getFullFileName()
public java.lang.String getFileContentType()
public java.io.ByteArrayOutputStream getFileOutputStream()
public java.io.ByteArrayOutputStream getFileOutputStreamForFile(java.lang.String fileName)
fileName
- the name of the file to retrieve the contentspublic java.util.HashMap getFileParams()
public java.util.HashMap getFileParamsForFile(java.lang.String fileName)
fileName
- the name of the file to retrieve the parametersprotected void readRequest(javax.servlet.http.HttpServletRequest request) throws java.io.IOException, MXException
java.io.IOException
- if the uploaded content is larger than
maxSize or there's a problem parsing the requestMXException
protected boolean readNextPart(psdi.webclient.system.controller.MPInputStreamHandler in, java.lang.String boundary) throws java.io.IOException
in
- the stream from which to read the partboundary
- the boundary separating partsjava.io.IOException
- if there's a problem reading or parsing the
requestprotected void readAndKeep(psdi.webclient.system.controller.MPInputStreamHandler in, java.lang.String boundary, java.lang.String filename, java.lang.String contentType) throws java.io.IOException
in
- the stream from which to read the file databoundary
- the boundary signifying the end of this partfilename
- the name of the uploaded filecontentType
- the content type of the filejava.io.IOException
- if there's a problem reading or parsing the
request