org.mortbay.servlet

Class 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 $
Authors:
Greg Wilkins
Jim Crossley

Constructor Summary

MultiPartRequest(HttpServletRequest request)
Constructor.

Method Summary

boolean
contains(String name)
Check if a named part is present
String
getFilename(String name)
Get any file name associated with a part.
String[]
getFilenames(String name)
InputStream
getInputStream(String name)
Get the data of a part as a stream.
InputStream[]
getInputStreams(String name)
Hashtable[]
getMultipleParams(String name)
Hashtable
getParams(String name)
Get the MIME parameters associated with a part.
String[]
getPartNames()
Get the part names.
String
getString(String name)
Get the data of a part as a string.
String[]
getStrings(String name)

Constructor Details

MultiPartRequest

public MultiPartRequest(HttpServletRequest request)
            throws IOException
Constructor.
Parameters:
request - The request containing a multipart/form-data request

Method Details

contains

public boolean contains(String name)
Check if a named part is present
Parameters:
name - The part
Returns:
true if it was included

getFilename

public String getFilename(String name)
Get any file name associated with a part.
Parameters:
name - The part name
Returns:
The filename

getFilenames

public String[] getFilenames(String name)

getInputStream

public InputStream getInputStream(String name)
Get the data of a part as a stream.
Parameters:
name - The part name
Returns:
Stream providing the part data

getInputStreams

public InputStream[] getInputStreams(String name)

getMultipleParams

public Hashtable[] getMultipleParams(String name)

getParams

public Hashtable getParams(String name)
Get the MIME parameters associated with a part.
Parameters:
name - The part name
Returns:
Hashtable of parameters

getPartNames

public String[] getPartNames()
Get the part names.
Returns:
an array of part names

getString

public String getString(String name)
Get the data of a part as a string.
Parameters:
name - The part name
Returns:
The part data

getStrings

public String[] getStrings(String name)
Parameters:
name - The part name
Returns:
The parts data

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