com.opensymphony.webwork.dispatcher.multipart
Class JakartaMultiPartRequest

java.lang.Object
  extended by com.opensymphony.webwork.dispatcher.multipart.MultiPartRequest
      extended by com.opensymphony.webwork.dispatcher.multipart.JakartaMultiPartRequest

public class JakartaMultiPartRequest
extends MultiPartRequest

Multipart form data request adapter for Jakarta's file upload package.

Author:
Bruce Ritchie

Field Summary
 
Fields inherited from class com.opensymphony.webwork.dispatcher.multipart.MultiPartRequest
log
 
Constructor Summary
JakartaMultiPartRequest(HttpServletRequest servletRequest, String saveDir, int maxSize)
          Creates a new request wrapper to handle multi-part data using methods adapted from Jason Pell's multipart classes (see class description).
 
Method Summary
 String[] getContentType(String fieldName)
          Returns the content type(s) of the file(s) associated with the specified field name (as supplied by the client browser), or null if no files are associated with the given field name.
 List getErrors()
          Returns a list of error messages that may have occurred while processing the request.
 File[] getFile(String fieldName)
          Returns a File object for the filename specified or null if no files are associated with the given field name.
 String[] getFileNames(String fieldName)
          Returns a String[] of file names for files associated with the specified input field name
 Enumeration getFileParameterNames()
          Returns an enumeration of the parameter names for uploaded files
 String[] getFilesystemName(String fieldName)
          Returns the file system name(s) of files associated with the given field name or null if no files are associated with the given field name.
 String getParameter(String name)
          Returns the specified request parameter.
 Enumeration getParameterNames()
          Returns an enumeration of String parameter names.
 String[] getParameterValues(String name)
          Returns a list of all parameter values associated with a parameter name.
 
Methods inherited from class com.opensymphony.webwork.dispatcher.multipart.MultiPartRequest
isMultiPart
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JakartaMultiPartRequest

public JakartaMultiPartRequest(HttpServletRequest servletRequest,
                               String saveDir,
                               int maxSize)
                        throws IOException
Creates a new request wrapper to handle multi-part data using methods adapted from Jason Pell's multipart classes (see class description).

Parameters:
maxSize - maximum size post allowed
saveDir - the directory to save off the file
servletRequest - the request containing the multipart
Throws:
IOException - is thrown if encoding fails.
Method Detail

getFileParameterNames

public Enumeration getFileParameterNames()
Description copied from class: MultiPartRequest
Returns an enumeration of the parameter names for uploaded files

Specified by:
getFileParameterNames in class MultiPartRequest
Returns:
an enumeration of the parameter names for uploaded files

getContentType

public String[] getContentType(String fieldName)
Description copied from class: MultiPartRequest
Returns the content type(s) of the file(s) associated with the specified field name (as supplied by the client browser), or null if no files are associated with the given field name.

Specified by:
getContentType in class MultiPartRequest
Parameters:
fieldName - input field name
Returns:
an array of content encoding for the specified input field name or null if no content type was specified.

getFile

public File[] getFile(String fieldName)
Description copied from class: MultiPartRequest
Returns a File object for the filename specified or null if no files are associated with the given field name.

Specified by:
getFile in class MultiPartRequest
Parameters:
fieldName - input field name
Returns:
a File[] object for files associated with the specified input field name

getFileNames

public String[] getFileNames(String fieldName)
Description copied from class: MultiPartRequest
Returns a String[] of file names for files associated with the specified input field name

Specified by:
getFileNames in class MultiPartRequest
Parameters:
fieldName - input field name
Returns:
a String[] of file names for files associated with the specified input field name

getFilesystemName

public String[] getFilesystemName(String fieldName)
Description copied from class: MultiPartRequest
Returns the file system name(s) of files associated with the given field name or null if no files are associated with the given field name.

Specified by:
getFilesystemName in class MultiPartRequest
Parameters:
fieldName - input field name
Returns:
the file system name(s) of files associated with the given field name

getParameter

public String getParameter(String name)
Description copied from class: MultiPartRequest
Returns the specified request parameter.

Specified by:
getParameter in class MultiPartRequest
Parameters:
name - the name of the parameter to get
Returns:
the parameter or null if it was not found.

getParameterNames

public Enumeration getParameterNames()
Description copied from class: MultiPartRequest
Returns an enumeration of String parameter names.

Specified by:
getParameterNames in class MultiPartRequest
Returns:
an enumeration of String parameter names.

getParameterValues

public String[] getParameterValues(String name)
Description copied from class: MultiPartRequest
Returns a list of all parameter values associated with a parameter name. If there is only one parameter value per name the resulting array will be of length 1.

Specified by:
getParameterValues in class MultiPartRequest
Parameters:
name - the name of the parameter.
Returns:
an array of all values associated with the parameter name.

getErrors

public List getErrors()
Description copied from class: MultiPartRequest
Returns a list of error messages that may have occurred while processing the request. If there are no errors, an empty list is returned. If the underlying implementation (ie: pell, cos, jakarta, etc) cannot support providing these errors, an empty list is also returned. This list of errors is repoted back to the MultiPartRequestWrapper's errors field.

Specified by:
getErrors in class MultiPartRequest
Returns:
a list of Strings that represent various errors during parsing

WebWork Project Page