org.melati.servlet
Class MultipartFormDataDecoder

Package class diagram package MultipartFormDataDecoder
java.lang.Object
  extended by org.melati.servlet.MultipartFormDataDecoder

public class MultipartFormDataDecoder
extends Object

Parses a multipart/form-data request into its different fields, saving any files it finds along the way.


Constructor Summary
MultipartFormDataDecoder(Melati melati, InputStream in, String contentType, FormDataAdaptorFactory factory)
          Constructor with default maximum size.
MultipartFormDataDecoder(Melati melati, InputStream in, String contentType, FormDataAdaptorFactory factory, int maxSize)
          Constructor specifying maximum size.
 
Method Summary
protected  String extractField(String header, String lBound, String rBound)
          Extract a String from header bounded by lBound and either: rBound or a "\r\n" or the end of the String.
 Hashtable<String,MultipartFormField> parseData()
          Parse the uploaded data into its constituents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultipartFormDataDecoder

public MultipartFormDataDecoder(Melati melati,
                                InputStream in,
                                String contentType,
                                FormDataAdaptorFactory factory)
Constructor with default maximum size.

Parameters:
melati - The Melati
in - An InputStream from which to read the data
contentType - A valid MIME type
factory - A FormDataAdaptorFactory to determine how to store the object's data

MultipartFormDataDecoder

public MultipartFormDataDecoder(Melati melati,
                                InputStream in,
                                String contentType,
                                FormDataAdaptorFactory factory,
                                int maxSize)
Constructor specifying maximum size.

Parameters:
melati - The Melati
in - An InputStream from which to read the data
contentType - A valid MIME type
factory - A FormDataAdaptorFactory to determine how to store the object's data
maxSize - The maximum size of the data
Method Detail

parseData

public Hashtable<String,MultipartFormField> parseData()
                                               throws IOException
Parse the uploaded data into its constituents.

Returns:
a Hashtable of the constituents
Throws:
IOException - if an error occurs reading the input stream

extractField

protected String extractField(String header,
                              String lBound,
                              String rBound)
Extract a String from header bounded by lBound and either: rBound or a "\r\n" or the end of the String.

Parameters:
header - The field metadata to read
lBound - Where to start reading from
rBound - where to stop reading
Returns:
The substring required


Copyright © 2000-2010 PanEris. All Rights Reserved.