http.utils.multipartrequest

Class ServletMultipartRequest


public class ServletMultipartRequest
extends MultipartRequest

A Multipart form data parser. Parses an input stream and writes out any files found, making available a hashtable of other url parameters. As of version 1.17 the files can be saved to memory, and optionally written to a database, etc.

Copyright (c)2001-2003 Jason Pell.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Email: jasonpell@hotmail.com Url: http://www.geocities.com/jasonpell
Wrapper for MultipartRequest

Field Summary

Fields inherited from class http.utils.multipartrequest.MultipartRequest

ABORT_IF_MAX_BYES_EXCEEDED, CONTENTS, CONTENT_TYPE, DEF_ENCODING, FILENAME, IGNORE_FILES_IF_MAX_BYES_EXCEEDED, MAX_READ_BYTES, RAW_FILENAME, READ_LINE_BLOCK, SIZE, TMP_FILENAME

Constructor Summary

ServletMultipartRequest(HttpServletRequest request, String strSaveDirectory)
Deprecated. Replaced by ServletMultipartRequest(ServletRequest, String, int, boolean, String)
ServletMultipartRequest(HttpServletRequest request, String strSaveDirectory, int intMaxReadBytes)
Deprecated. Replaced by ServletMultipartRequest(ServletRequest, String, int, boolean, String)
ServletMultipartRequest(HttpServletRequest request, int intMaxReadBytes)
Deprecated. Replaced by ServletMultipartRequest(ServletRequest, int, boolean, String)
ServletMultipartRequest(ServletRequest request, String strSaveDirectory, int intMaxReadBytes, String encoding)
Standard Constructor
ServletMultipartRequest(ServletRequest request, String strSaveDirectory, int intMaxReadBytes, int maxBytesExceededMode, String encoding)
Standard Constructor
ServletMultipartRequest(ServletRequest request, int intMaxReadBytes, String encoding)
Memory Constructor
ServletMultipartRequest(ServletRequest request, int intMaxReadBytes, int maxBytesExceededMode, String encoding)
Memory Constructor

Method Summary

Methods inherited from class http.utils.multipartrequest.MultipartRequest

debug, getBaseFilename, getContentType, getEncoding, getFile, getFileContents, getFileParameter, getFileParameterNames, getFileSize, getFileSystemName, getHtmlTable, getParameterNames, getRawFilename, getURLParameter, getURLParameters, isMaxBytesExceeded, setEncoding

Constructor Details

ServletMultipartRequest

public ServletMultipartRequest(HttpServletRequest request,
                               String strSaveDirectory)
            throws IllegalArgumentException,
                   IOException

Deprecated. Replaced by ServletMultipartRequest(ServletRequest, String, int, boolean, String)


ServletMultipartRequest

public ServletMultipartRequest(HttpServletRequest request,
                               String strSaveDirectory,
                               int intMaxReadBytes)
            throws IllegalArgumentException,
                   IOException

Deprecated. Replaced by ServletMultipartRequest(ServletRequest, String, int, boolean, String)


ServletMultipartRequest

public ServletMultipartRequest(HttpServletRequest request,
                               int intMaxReadBytes)
            throws IllegalArgumentException,
                   IOException

Deprecated. Replaced by ServletMultipartRequest(ServletRequest, int, boolean, String)


ServletMultipartRequest

public ServletMultipartRequest(ServletRequest request,
                               String strSaveDirectory,
                               int intMaxReadBytes,
                               String encoding)
            throws IllegalArgumentException,
                   IOException
Standard Constructor
Parameters:
request - The ServletRequest will be used to initialise the MultipartRequest super class.
strSaveDirectory - The temporary directory to save the file from where they can then be moved to wherever by the calling process. If you specify null for this parameter, then any files uploaded will be silently ignored.
intMaxReadBytes - Overrides the MAX_BYTES_READ value, to allow arbitrarily long files.
encoding - Sets the encoding to use. If null, ISO-8859-1 will be used.

ServletMultipartRequest

public ServletMultipartRequest(ServletRequest request,
                               String strSaveDirectory,
                               int intMaxReadBytes,
                               int maxBytesExceededMode,
                               String encoding)
            throws IllegalArgumentException,
                   IOException
Standard Constructor
Parameters:
request - The ServletRequest will be used to initialise the MultipartRequest super class.
strSaveDirectory - The temporary directory to save the file from where they can then be moved to wherever by the calling process. If you specify null for this parameter, then any files uploaded will be silently ignored.
intMaxReadBytes - Overrides the MAX_BYTES_READ value, to allow arbitrarily long files.
maxBytesExceededMode - This controls how the parser will process a request which is in excess of the intMaxReadBytes parameter. The possible modes are:
  • MultipartRequest.ABORT_IF_MAX_BYES_EXCEEDED - The parser will throw a MaxBytesReadException
  • MultipartRequest.IGNORE_FILES_IF_MAX_BYES_EXCEEDED - All parameters will be processed, but any file content will be discarded. WARNING: There is still potential for a Denial-of-Service. For instance, an attacker can send many megabytes of non-file form data.
    encoding - Sets the encoding to use. If null, ISO-8859-1 will be used.

    ServletMultipartRequest

    public ServletMultipartRequest(ServletRequest request,
                                   int intMaxReadBytes,
                                   String encoding)
                throws IllegalArgumentException,
                       IOException
    Memory Constructor
    Parameters:
    request - The ServletRequest will be used to initialise the MultipartRequest super class.
    intMaxReadBytes - Overrides the MA_BYTES_READ value, to allow arbitrarily long files.
    encoding - Sets the encoding to use. If null, ISO-8859-1 will be used.

    ServletMultipartRequest

    public ServletMultipartRequest(ServletRequest request,
                                   int intMaxReadBytes,
                                   int maxBytesExceededMode,
                                   String encoding)
                throws IllegalArgumentException,
                       IOException
    Memory Constructor
    Parameters:
    request - The ServletRequest will be used to initialise the MultipartRequest super class.
    intMaxReadBytes - Overrides the MA_BYTES_READ value, to allow arbitrarily long files.
    maxBytesExceededMode - This controls how the parser will process a request which is in excess of the intMaxReadBytes parameter. The possible modes are:
    • MultipartRequest.ABORT_IF_MAX_BYES_EXCEEDED - The parser will throw a MaxBytesReadException
    • MultipartRequest.IGNORE_FILES_IF_MAX_BYES_EXCEEDED - All parameters will be processed, but any file content will be discarded. WARNING: There is still potential for a Denial-of-Service. For instance, an attacker can send many megabytes of non-file form data.
      encoding - Sets the encoding to use. If null, ISO-8859-1 will be used.