org.mortbay.servlet
Class MultiPartRequest

java.lang.Object
  |
  +--org.mortbay.servlet.MultiPartRequest

public class MultiPartRequest
extends java.lang.Object

Multipart Form Data request.

This class decodes the multipart/form-data stream sent by a HTML form that uses a file input item.

Usage

Each part of the form data is named from the HTML form and is available either via getString(name) or getInputStream(name). Furthermore the MIME parameters and filename can be requested for each part.
 

Version:
$Id: MultiPartRequest.java,v 1.5 2003/05/01 21:14:54 gregwilkins Exp $
Author:
Greg Wilkins, Jim Crossley

Constructor Summary
MultiPartRequest(HttpServletRequest request)
          Constructor.
 
Method Summary
 boolean contains(java.lang.String name)
          Check if a named part is present
 java.lang.String getFilename(java.lang.String name)
          Get any file name associated with a part.
 java.io.InputStream getInputStream(java.lang.String name)
          Get the data of a part as a stream.
 java.util.Hashtable getParams(java.lang.String name)
          Get the MIME parameters associated with a part.
 java.lang.String[] getPartNames()
          Get the part names.
 java.lang.String getString(java.lang.String name)
          Get the data of a part as a string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiPartRequest

public MultiPartRequest(HttpServletRequest request)
                 throws java.io.IOException
Constructor.

Parameters:
request - The request containing a multipart/form-data request
Throws:
java.io.IOException - IOException
Method Detail

getPartNames

public java.lang.String[] getPartNames()
Get the part names.

Returns:
an array of part names

contains

public boolean contains(java.lang.String name)
Check if a named part is present

Parameters:
name - The part
Returns:
true if it was included

getString

public java.lang.String getString(java.lang.String name)
Get the data of a part as a string.

Parameters:
name - The part name
Returns:
The part data

getInputStream

public java.io.InputStream getInputStream(java.lang.String name)
Get the data of a part as a stream.

Parameters:
name - The part name
Returns:
Stream providing the part data

getParams

public java.util.Hashtable getParams(java.lang.String name)
Get the MIME parameters associated with a part.

Parameters:
name - The part name
Returns:
Hashtable of parameters

getFilename

public java.lang.String getFilename(java.lang.String name)
Get any file name associated with a part.

Parameters:
name - The part name
Returns:
The filename


Copyright ? 2000 Mortbay Consulting Pty. Ltd. All Rights Reserved.