Servertec
File Upload
1.1.2 09/04/2005

stec.servlet.http
Class MultiPartForm

java.lang.Object
  extended by stec.servlet.http.MultiPartForm

public class MultiPartForm
extends java.lang.Object

Class used to parse multi-part forms.

Implements Form-based File Uploads in HTML as documentated in RFC 1867 for supporting <FORM ENCTYPE="multipart/form-data" ACTION="servletalias" METHOD="POST"> HTML tag.

Notes:

Internally the parse() method parses the post data and depending on the arguments used will store the uploaded file(s) on the file system or in the FileObject object(s).

The parse() method will throw a java.lang.Exception if the post data is partually or fully processesd by the Servlet engine, Servlet, JavaServer Pages (JSP) engine or JSP page.

Since:
1.0.0 04/29/2001

Constructor Summary
MultiPartForm()
           
 
Method Summary
static java.util.Hashtable parse(HttpServletRequest request, java.lang.String basedir, int max_content_length)
          Returns a hashtable containing the form elements using the platform's default character set.
static java.util.Hashtable parse(HttpServletRequest request, java.lang.String basedir, int max_content_length, java.lang.String charset)
          Returns a hashtable containing the form elements using the specified character set.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiPartForm

public MultiPartForm()
Method Detail

parse

public static java.util.Hashtable parse(HttpServletRequest request,
                                        java.lang.String basedir,
                                        int max_content_length)
                                 throws java.lang.Exception
Returns a hashtable containing the form elements using the platform's default character set.

Converts encoded characters using the platform's default character set.

Parameters:
request - the servlet request object.
basedir - the base directory to use.

null, if none. If none then the file are uploaded into a buffer which can be accessed using getBuffer().

max_content_length - the maximum length of the request.

-1 if unlimited. Using -1 can open the server to denial of service attacks.

Returns:
contains the form elements and uploaded files.

Each form element is a Vector of items containing either a String or a FileUpload object. String is used by form elements and FileUpload object is used by uploaded files.

Throws:
java.lang.Exception - for invalid content type, when content length exceeds maximum content length, when content boundary is not found, when end is found while searching for content and when content header is not valid.
Since:
1.0.0 04/29/2001

parse

public static java.util.Hashtable parse(HttpServletRequest request,
                                        java.lang.String basedir,
                                        int max_content_length,
                                        java.lang.String charset)
                                 throws java.lang.Exception
Returns a hashtable containing the form elements using the specified character set.

Converts encoded characters using the specified character set.

Parameters:
request - the servlet request object.
basedir - the base directory to use.

null, if none. If none then the file is uploaded into a buffer which can be accessed using getBuffer().

max_content_length - the maximum length of the request.

-1 if unlimited. Using -1 can open the server to denial of service attacks.

charset - the name of a supported character set. null if no character set is to be used.
Returns:
contains the form elements and uploaded files.

Each form element is a Vector of items containing either a String or a FileUpload object. String is used by form elements and FileUpload object is used by uploaded files.

Throws:
java.lang.Exception - for invalid content type, when content length exceeds maximum content length, when content boundary is not found, when end is found while searching for content and when content header is not valid.
Since:
1.1.0 12/17/2001

Servertec
File Upload
1.1.2 09/04/2005

Copyright © 2001-2005 Servertec. All rights reserved.