DiskMultipartRequestHandler (Apache Struts API Documentation)
Keywords: org.apache.struts.upload.DiskMultipartRequestHandler,DiskMultipartRequestHandler class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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.

Fields inherited from interface org.apache.struts.upload.MultipartRequestHandler
`ATTRIBUTE_MAX_LENGTH_EXCEEDED`

Constructor Summary
`DiskMultipartRequestHandler()`

Method Summary
`protected void` | `createDiskFile(MultipartElement element)`
`protected void` | `createTextElement(javax.servlet.http.HttpServletRequest request, MultipartElement element)`
`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` | `getMaxSize()` Gets the maximum post data size in bytes from the string representation in the configuration file.
`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, 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`
  Throws:
    `javax.servlet.ServletException` - thrown if something goes wrong

### createTextElement

    protected void createTextElement(javax.servlet.http.HttpServletRequest request,
                                     MultipartElement element)

### createDiskFile

    protected void createDiskFile(MultipartElement element)

### 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`
  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`
  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`
  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`

### getMaxSize

    protected long getMaxSize()
                       throws javax.servlet.ServletException

  Gets the maximum post data size in bytes from the string representation in the configuration file.

    `javax.servlet.ServletException`

### retrieveTempDir

    protected void retrieveTempDir()

  Retrieves the temporary directory from either ActionServlet, a context property, or a system property, in that order.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2002 - Apache Software Foundation