|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.servlet.ServletRequestWrapper
javax.servlet.http.HttpServletRequestWrapper
com.opensymphony.webwork.dispatcher.WebWorkRequestWrapper
com.opensymphony.webwork.dispatcher.multipart.MultiPartRequestWrapper
public class MultiPartRequestWrapper
Parses a multipart request and provides a wrapper around the request. The parsing implementation used
depends on the webwork.multipart.parser setting. It should be set to a class which
extends MultiPartRequest
.
Webwork ships with three implementations,
PellMultiPartRequest
, and
com.opensymphony.webwork.dispatcher.multipart.CosMultiPartRequest
and
JakartaMultiPartRequest
. The Jakarta implementation
is the default. The webwork.multipart.parser property should be set to jakarta for the
Jakarta implementation, pell for the Pell implementation and cos for the Jason Hunter
implementation. The files are uploaded when the object is instantiated. If there are any errors they are logged using
addError(String)
. An action handling a multipart form should first check hasErrors()
before doing any other processing.
Field Summary | |
---|---|
protected static org.apache.commons.logging.Log |
log
|
Fields inherited from interface javax.servlet.http.HttpServletRequest |
---|
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH |
Constructor Summary | |
---|---|
MultiPartRequestWrapper(HttpServletRequest request,
String saveDir,
int maxSize)
Instantiates the appropriate MultiPartRequest parser implementation and processes the data. |
Method Summary | |
---|---|
protected void |
addError(String anErrorMessage)
Adds an error message. |
String |
getContentType(String fieldName)
Deprecated. use getContentTypes(String) instead |
String[] |
getContentTypes(String name)
Get an array of content encoding for the specified input field name or null if no content type was specified. |
Collection |
getErrors()
Returns a collection of any errors generated when parsing the multipart request. |
File |
getFile(String fieldName)
Deprecated. use getFiles(String) instead |
Enumeration |
getFileNames()
Deprecated. use getFileParameterNames() instead |
String[] |
getFileNames(String fieldName)
Get a String array of the file names for uploaded files |
Enumeration |
getFileParameterNames()
Get an enumeration of the parameter names for uploaded files |
File[] |
getFiles(String fieldName)
Get a File[] for the given input field name. |
String |
getFilesystemName(String fieldName)
Deprecated. use getFileSystemNames(String) instead |
String[] |
getFileSystemNames(String fieldName)
Get the filename(s) of the file(s) uploaded for the given input field name. |
String |
getParameter(String name)
|
Map |
getParameterMap()
|
Enumeration |
getParameterNames()
|
String[] |
getParameterValues(String name)
|
boolean |
hasErrors()
Returns true if any errors occured when parsing the HTTP multipart request, false otherwise. |
protected Enumeration |
mergeParams(Enumeration params1,
Enumeration params2)
Merges 2 enumeration of parameters as one. |
Methods inherited from class com.opensymphony.webwork.dispatcher.WebWorkRequestWrapper |
---|
getAttribute |
Methods inherited from class javax.servlet.ServletRequestWrapper |
---|
getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocale, getLocales, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRequest, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding, setRequest |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.servlet.ServletRequest |
---|
getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocale, getLocales, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding |
Field Detail |
---|
protected static final org.apache.commons.logging.Log log
Constructor Detail |
---|
public MultiPartRequestWrapper(HttpServletRequest request, String saveDir, int maxSize)
request
- the servlet request objectsaveDir
- directory to save the file(s) tomaxSize
- maximum file size allowedMethod Detail |
---|
public Enumeration getFileNames()
getFileParameterNames()
instead
public Enumeration getFileParameterNames()
public String getContentType(String fieldName)
getContentTypes(String)
instead
public String[] getContentTypes(String name)
name
- input field name
public File getFile(String fieldName)
getFiles(String)
instead
public File[] getFiles(String fieldName)
File[]
for the given input field name.
fieldName
- input field name
public String[] getFileNames(String fieldName)
public String getFilesystemName(String fieldName)
getFileSystemNames(String)
instead
public String[] getFileSystemNames(String fieldName)
fieldName
- input field name
public String getParameter(String name)
getParameter
in interface ServletRequest
getParameter
in class ServletRequestWrapper
ServletRequest.getParameter(String)
public Map getParameterMap()
getParameterMap
in interface ServletRequest
getParameterMap
in class ServletRequestWrapper
ServletRequest.getParameterMap()
public Enumeration getParameterNames()
getParameterNames
in interface ServletRequest
getParameterNames
in class ServletRequestWrapper
ServletRequest.getParameterNames()
public String[] getParameterValues(String name)
getParameterValues
in interface ServletRequest
getParameterValues
in class ServletRequestWrapper
ServletRequest.getParameterValues(String)
public boolean hasErrors()
public Collection getErrors()
protected void addError(String anErrorMessage)
anErrorMessage
- the error message to report.protected Enumeration mergeParams(Enumeration params1, Enumeration params2)
params1
- the first enumeration.params2
- the second enumeration.
|
WebWork Project Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |