com.ibm.wps.portlets.struts.upload
Class WpsCommonsMultipartRequestHandler

java.lang.Object
  extended by CommonsMultipartRequestHandler
      extended by com.ibm.wps.portlets.struts.upload.WpsCommonsMultipartRequestHandler
All Implemented Interfaces:
IWpsCommonsMultipartRequestHandler

public class WpsCommonsMultipartRequestHandler
extends CommonsMultipartRequestHandler
implements IWpsCommonsMultipartRequestHandler

This is a modified version of the Struts CommonsMultipartRequestHandler that has the DBCS fix for the file name. This request handler will not be needed in future releases of Struts.

Since:
5.1

Field Summary
protected  java.util.Hashtable elementsAll
          The combined text and file request parameters.
protected  java.util.Hashtable elementsFile
          The file request parameters.
protected  java.util.Hashtable elementsText
          The text request parameters.
protected static Log log
          The commons-logging instance for this class.
 
Constructor Summary
WpsCommonsMultipartRequestHandler()
          WpsCommonsMultipartRequestHandler constructor.
 
Method Summary
protected  void addFileParameter(HttpServletRequest request, FileItem item)
          Adds a file parameter to the set of file parameters for this request and also to the list of all parameters.
protected  void addTextParameter(HttpServletRequest request, FileItem item)
          Adds a regular text parameter to the set of text parameters for this request and also to the list of all parameters.
 void finish()
          Cleans up at the end of a request.
 java.util.Hashtable getAllElements()
          Returns a hash table containing both text and file request parameters.
 java.util.Hashtable getFileElements()
          Returns a hash table containing the file (that is, non-text) request parameters.
protected  long getSizeFieldThreshold(ModuleConfig mc)
          Returns the size field threshold which determines whether an uploaded file will be written to disk or cached in memory.
 java.util.Hashtable getTextElements()
          Returns a hash table containing the text (that is, non-file) request parameters.
 void handleRequest(HttpServletRequest request)
          Parses the input stream and partitions the parsed items into a set of form fields and a set of file items.
 void rollback()
          Cleans up when a problem occurs during request processing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static Log log
The commons-logging instance for this class.


elementsAll

protected java.util.Hashtable elementsAll
The combined text and file request parameters.


elementsFile

protected java.util.Hashtable elementsFile
The file request parameters.


elementsText

protected java.util.Hashtable elementsText
The text request parameters.

Constructor Detail

WpsCommonsMultipartRequestHandler

public WpsCommonsMultipartRequestHandler()
WpsCommonsMultipartRequestHandler constructor.

Method Detail

handleRequest

public void handleRequest(HttpServletRequest request)
                   throws ServletException
Parses the input stream and partitions the parsed items into a set of form fields and a set of file items. In the process, the parsed items are translated from Commons FileUpload FileItem instances to Struts FormFile instances.

Parameters:
request - The multipart request to be processed.
Throws:
ServletException - if an unrecoverable error occurs.

getTextElements

public java.util.Hashtable getTextElements()
Returns a hash table containing the text (that is, non-file) request parameters.

Returns:
The text request parameters.

getFileElements

public java.util.Hashtable getFileElements()
Returns a hash table containing the file (that is, non-text) request parameters.

Returns:
The file request parameters.

getAllElements

public java.util.Hashtable getAllElements()
Returns a hash table containing both text and file request parameters.

Returns:
The text and file request parameters.

rollback

public void rollback()
Cleans up when a problem occurs during request processing.


finish

public void finish()
Cleans up at the end of a request.


addTextParameter

protected void addTextParameter(HttpServletRequest request,
                                FileItem item)
Adds a regular text parameter to the set of text parameters for this request and also to the list of all parameters. Handles the case of multiple values for the same parameter by using an array for the parameter value.

Parameters:
request - The request in which the parameter was specified.
item - The file item for the parameter to add.

addFileParameter

protected void addFileParameter(HttpServletRequest request,
                                FileItem item)
Adds a file parameter to the set of file parameters for this request and also to the list of all parameters.

Parameters:
item - The file item for the parameter to add.

getSizeFieldThreshold

protected long getSizeFieldThreshold(ModuleConfig mc)
Returns the size field threshold which determines whether an uploaded file will be written to disk or cached in memory.

Parameters:
mc - The current module's configuration.
Returns:
The size threshold, in bytes.