org.apache.struts.upload
Class DiskMultipartRequestHandler

java.lang.Object
  |
  +--org.apache.struts.upload.DiskMultipartRequestHandler
All Implemented Interfaces:
MultipartRequestHandler

public class DiskMultipartRequestHandler
extends java.lang.Object
implements MultipartRequestHandler

This is a MultipartRequestHandler that writes file data directly to to temporary files on disk.

Author:
Mike Schachter

Field Summary
protected  java.util.Hashtable allElements
          A Hashtable representing all elemnents
protected  java.util.Hashtable fileElements
          A Hashtable representing the form files uploaded
protected  ActionMapping mapping
          The ActionMapping instance used for this class
protected  ActionServlet servlet
          The ActionServlet instance used for this class
protected  java.lang.String tempDir
          The temporary directory
protected  java.util.Hashtable textElements
          A Hashtable representing the form text input names and values
 
Constructor Summary
DiskMultipartRequestHandler()
           
 
Method Summary
 void finish()
          Calls on rollback() to delete temporary files
 java.util.Hashtable getAllElements()
          This method returns all elements of a multipart request.
 java.util.Hashtable getFileElements()
          This method is called on to retrieve all the FormFile input elements of the request.
 ActionMapping getMapping()
          Get the ActionMapping instance for this request
protected  long getMaxSizeFromServlet()
          Gets the maximum post data size in bytes from the string representation in ActionServlet
 ActionServlet getServlet()
          Get the ActionServlet instance
 java.util.Hashtable getTextElements()
          This method is called on to retrieve all the text input elements of the request.
 void handleRequest(javax.servlet.http.HttpServletRequest request)
          This method populates the internal hashtables with multipart request data.
protected  void retrieveTempDir()
          Retrieves the temporary directory from either ActionServlet, a context property, or a system property, in that order
 void rollback()
          Delete all the files uploaded
 void setMapping(ActionMapping mapping)
          Convienience method to set a reference to a working ActionMapping instance.
 void setServlet(ActionServlet servlet)
          Convienience method to set a reference to a working ActionServlet instance.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

servlet

protected ActionServlet servlet
The ActionServlet instance used for this class

mapping

protected ActionMapping mapping
The ActionMapping instance used for this class

fileElements

protected java.util.Hashtable fileElements
A Hashtable representing the form files uploaded

textElements

protected java.util.Hashtable textElements
A Hashtable representing the form text input names and values

allElements

protected java.util.Hashtable allElements
A Hashtable representing all elemnents

tempDir

protected java.lang.String tempDir
The temporary directory
Constructor Detail

DiskMultipartRequestHandler

public DiskMultipartRequestHandler()
Method Detail

handleRequest

public void handleRequest(javax.servlet.http.HttpServletRequest request)
                   throws javax.servlet.ServletException
This method populates the internal hashtables with multipart request data. If the request argument is an instance of MultipartRequestWrapper, the request wrapper will be populated as well.
Specified by:
handleRequest in interface MultipartRequestHandler
Following copied from interface: org.apache.struts.upload.MultipartRequestHandler
Throws:
javax.servlet.ServletException - thrown if something goes wrong

getAllElements

public java.util.Hashtable getAllElements()
Description copied from interface: MultipartRequestHandler
This method returns all elements of a multipart request.
Specified by:
getAllElements in interface MultipartRequestHandler
Following copied from interface: org.apache.struts.upload.MultipartRequestHandler
Returns:
A Hashtable where the keys are input names and values are either Strings or FormFiles

getTextElements

public java.util.Hashtable getTextElements()
Description copied from interface: MultipartRequestHandler
This method is called on to retrieve all the text input elements of the request.
Specified by:
getTextElements in interface MultipartRequestHandler
Following copied from interface: org.apache.struts.upload.MultipartRequestHandler
Returns:
A Hashtable where the keys and values are the names and values of the request input parameters

getFileElements

public java.util.Hashtable getFileElements()
Description copied from interface: MultipartRequestHandler
This method is called on to retrieve all the FormFile input elements of the request.
Specified by:
getFileElements in interface MultipartRequestHandler
Following copied from interface: org.apache.struts.upload.MultipartRequestHandler
Returns:
A Hashtable where the keys are the input names of the files and the values are FormFile objects
See Also:
FormFile

rollback

public void rollback()
Delete all the files uploaded
Specified by:
rollback in interface MultipartRequestHandler

finish

public void finish()
Calls on rollback() to delete temporary files
Specified by:
finish in interface MultipartRequestHandler

setServlet

public void setServlet(ActionServlet servlet)
Description copied from interface: MultipartRequestHandler
Convienience method to set a reference to a working ActionServlet instance.
Specified by:
setServlet in interface MultipartRequestHandler

setMapping

public void setMapping(ActionMapping mapping)
Description copied from interface: MultipartRequestHandler
Convienience method to set a reference to a working ActionMapping instance.
Specified by:
setMapping in interface MultipartRequestHandler

getServlet

public ActionServlet getServlet()
Description copied from interface: MultipartRequestHandler
Get the ActionServlet instance
Specified by:
getServlet in interface MultipartRequestHandler

getMapping

public ActionMapping getMapping()
Description copied from interface: MultipartRequestHandler
Get the ActionMapping instance for this request
Specified by:
getMapping in interface MultipartRequestHandler

getMaxSizeFromServlet

protected long getMaxSizeFromServlet()
                              throws javax.servlet.ServletException
Gets the maximum post data size in bytes from the string representation in ActionServlet

retrieveTempDir

protected void retrieveTempDir()
Retrieves the temporary directory from either ActionServlet, a context property, or a system property, in that order


Copyright © 2000-2001 - Apache Software Foundation