org.mortbay.servlet
Class MultiPartRequest

java.lang.Object
  extended by 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.16 2005/12/02 20:13:52 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.lang.String[] getFilenames(java.lang.String name)
           
 java.io.InputStream getInputStream(java.lang.String name)
          Get the data of a part as a stream.
 java.io.InputStream[] getInputStreams(java.lang.String name)
           
 java.util.Hashtable[] getMultipleParams(java.lang.String name)
           
 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.
 java.lang.String[] getStrings(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, 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

getStrings

public java.lang.String[] getStrings(java.lang.String name)
Parameters:
name - The part name
Returns:
The parts 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

getInputStreams

public java.io.InputStream[] getInputStreams(java.lang.String name)

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

getMultipleParams

public java.util.Hashtable[] getMultipleParams(java.lang.String name)

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

getFilenames

public java.lang.String[] getFilenames(java.lang.String name)


Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.