public class MultipartRequest extends MultipartStreamParser
<form method="post" enctype="multipart/form-data" accept-charset="charset"...
"accept-charset" may be used in case when jsp page uses specific encoding. If default encoding is used, this attribute is not required.
MultipleRequest class may be created in two ways:
1) with the constructors, when user must prevent instantiating more than once;
2) using static factory methods, which always return valid MultipleRequest instance.
This class loads complete request. To prevent big uploads (and potential DoS attacks) check content length before loading.
fileUploadFactory, requestFiles, requestParameters
Constructor and Description |
---|
MultipartRequest(javax.servlet.http.HttpServletRequest request,
FileUploadFactory fileUploadFactory,
java.lang.String encoding)
Creates new multi-part request with form encoding and file upload factory.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getCharacterEncoding()
Returns current encoding.
|
int |
getContentLength()
Returns request content length.
|
static MultipartRequest |
getInstance(javax.servlet.http.HttpServletRequest request)
Returns new or existing instance of
MultipartRequest . |
static MultipartRequest |
getInstance(javax.servlet.http.HttpServletRequest request,
FileUploadFactory fileUploadFactory,
java.lang.String encoding)
Returns new or existing instance of
MultipartRequest . |
javax.servlet.http.HttpServletRequest |
getServletRequest()
Returns actual http servlet request instance.
|
void |
parseMultipartRequest()
Loads and parse multi-part request.
|
void |
parseRequest()
Checks if request if multi-part and parse it.
|
getFile, getFileParameterNames, getFiles, getParameter, getParameterNames, getParameterValues, isParsed, parseRequestStream, putFile, putParameter, putParameters, setParsed
public MultipartRequest(javax.servlet.http.HttpServletRequest request, FileUploadFactory fileUploadFactory, java.lang.String encoding)
parseMultipartRequest()
or
parseRequest()
to parse before further usage.
If not specified, character encoding is read from the request. If not specified there, default Jodd encoding is used.
Multiple instantiation doesn't work, since input stream can be parsed just once.
Still, if it is needed, use getInstance(javax.servlet.http.HttpServletRequest, FileUploadFactory, String)
instead.
request
- http requestencoding
- form encoding or null
fileUploadFactory
- file factory, or null
for default factorypublic javax.servlet.http.HttpServletRequest getServletRequest()
public int getContentLength()
public java.lang.String getCharacterEncoding()
public static MultipartRequest getInstance(javax.servlet.http.HttpServletRequest request, FileUploadFactory fileUploadFactory, java.lang.String encoding) throws java.io.IOException
MultipartRequest
.java.io.IOException
public static MultipartRequest getInstance(javax.servlet.http.HttpServletRequest request) throws java.io.IOException
MultipartRequest
.java.io.IOException
public void parseMultipartRequest() throws java.io.IOException
java.io.IOException
public void parseRequest() throws java.io.IOException
java.io.IOException
MultipartRequestWrapper
Copyright © 2003-present Jodd Team