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.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.
|
java.util.Map |
getParts() |
static boolean |
isNull(java.lang.String val) |
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(com.ibm.tivoli.maximo.oslc.provider.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(com.ibm.tivoli.maximo.oslc.provider.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 java.util.Map getParts()
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 static boolean isNull(java.lang.String val)
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()
protected 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(com.ibm.tivoli.maximo.oslc.provider.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(com.ibm.tivoli.maximo.oslc.provider.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