| |
|
| org.apache.struts2.dispatcher.StrutsRequestWrapper org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper
MultiPartRequestWrapper | public class MultiPartRequestWrapper extends StrutsRequestWrapper (Code) | | Parse a multipart request and provide a wrapper around the request. The parsing implementation used
depends on the struts.multipart.parser setting. It should be set to a class which
extends
org.apache.struts2.dispatcher.multipart.MultiPartRequest .
The struts.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
MultiPartRequestWrapper.addError(String) . An action handling a multipart form should first check
MultiPartRequestWrapper.hasErrors() before doing any other processing.
An alternate implementation, PellMultiPartRequest, is provided as a plugin.
|
log | final protected static Log log(Code) | | |
MultiPartRequestWrapper | public MultiPartRequestWrapper(MultiPartRequest multiPartRequest, HttpServletRequest request, String saveDir)(Code) | | Process file downloads and log any errors.
Parameters: request - Our HttpServletRequest object Parameters: saveDir - Target directory for any files that we save Parameters: multiPartRequest - Our MultiPartRequest object |
addError | protected void addError(String anErrorMessage)(Code) | | Adds an error message.
Parameters: anErrorMessage - the error message to report. |
getContentTypes | public String[] getContentTypes(String name)(Code) | | Get an array of content encoding for the specified input field name or null if
no content type was specified.
Parameters: name - input field name an array of content encoding for the specified input field name |
getErrors | public Collection<String> getErrors()(Code) | | Returns a collection of any errors generated when parsing the multipart request.
the error Collection. |
getFileNames | public String[] getFileNames(String fieldName)(Code) | | Get a String array of the file names for uploaded files
Parameters: fieldName - Field to check for file names. a String[] of file names for uploaded files |
getFileParameterNames | public Enumeration<String> getFileParameterNames()(Code) | | Get an enumeration of the parameter names for uploaded files
enumeration of parameter names for uploaded files |
getFileSystemNames | public String[] getFileSystemNames(String fieldName)(Code) | | Get the filename(s) of the file(s) uploaded for the given input field name.
Returns null if the file is not found.
Parameters: fieldName - input field name the filename(s) of the file(s) uploaded for the given input field name ornull if name not found. |
getFiles | public File[] getFiles(String fieldName)(Code) | | Get a
java.io.File[] for the given input field name.
Parameters: fieldName - input field name a File[] object for files associated with the specified input field name |
hasErrors | public boolean hasErrors()(Code) | | Returns true if any errors occured when parsing the HTTP multipart request, false otherwise.
true if any errors occured when parsing the HTTP multipart request, false otherwise. |
mergeParams | protected Enumeration mergeParams(Enumeration params1, Enumeration params2)(Code) | | Merges 2 enumeration of parameters as one.
Parameters: params1 - the first enumeration. Parameters: params2 - the second enumeration. a single Enumeration of all elements from both Enumerations. |
|
|
|