Oracle UIX API Reference
Release 2.1.22.0.0
B12196-01

oracle.cabo.share.util
Class MultipartFormHandler

java.lang.Object
  |
  +--oracle.cabo.share.util.MultipartFormHandler

public class MultipartFormHandler
extends java.lang.Object

MultipartFormHandler - parses an incoming file upload post. This classs parses the incoming post and returns MultipartStreamItems for each form item.

If setCharacterEncoding() is called (with anything other than null), then strings returned from this class will be character-set decoded. Otherwise, strings returned from this class are not character-set decoded. In this way, MultipartFormHandler precisely matches the behavior of ServletRequest. Clients should use CaboHttpUtils.decodeRequestParameter() to decode any returned parameters.


Constructor Summary
MultipartFormHandler(javax.servlet.ServletRequest request)
          Create a MultipartFormHandler for the given servlet request.
MultipartFormHandler(java.lang.String type, java.io.InputStream in)
          Create a MultipartFormHandler for the given InputStream and content type.
 
Method Summary
 long getBytesRead()
          Returns the total number of bytes yet read.
 java.lang.String getCharacterEncoding()
          Gets the character enocoding.
 long getMaximumAllowedBytes()
          Gets the maximum number of bytes that MultipartFormItem.writeFile() will be allowed to write.
 MultipartFormItem getNextPart()
          Returns the next MultipartStreamItem from the request, or null if no more are present.
 long getTotalBytes()
          Returns the total size of the incoming content, or -1 if the length is not known.
static boolean isMultipartRequest(javax.servlet.ServletRequest request)
          Returns true if the servlet request is a multipart request.
 void setCharacterEncoding(java.lang.String characterEncoding)
          Sets the character encoding.
 void setMaximumAllowedBytes(long maxAllowedBytes)
          Sets the maximum number of bytes that MultipartFormItem.writeFile() will be allowed to write.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultipartFormHandler

public MultipartFormHandler(javax.servlet.ServletRequest request)
                     throws java.io.IOException
Create a MultipartFormHandler for the given servlet request.

MultipartFormHandler

public MultipartFormHandler(java.lang.String type,
                            java.io.InputStream in)
                     throws java.io.IOException
Create a MultipartFormHandler for the given InputStream and content type.
Parameters:
type - The content type, including the boundary string. The content type must be "multipart/form-data", and must define the multipart boundary value.
in - The InputStream which provides the multipart/form-data content
Method Detail

isMultipartRequest

public static boolean isMultipartRequest(javax.servlet.ServletRequest request)
Returns true if the servlet request is a multipart request.

getCharacterEncoding

public java.lang.String getCharacterEncoding()
Gets the character enocoding.

setCharacterEncoding

public void setCharacterEncoding(java.lang.String characterEncoding)
                          throws java.io.UnsupportedEncodingException
Sets the character encoding. If left to default, Strings will be decoded for ISO-8859-1. Clients should set the character encoding if they do not expect another part of their processing to decode the strings for them.

getBytesRead

public long getBytesRead()
Returns the total number of bytes yet read.

getTotalBytes

public long getTotalBytes()
Returns the total size of the incoming content, or -1 if the length is not known.
Returns:
an integer containing the length of the request or -1 if the length is not known

setMaximumAllowedBytes

public void setMaximumAllowedBytes(long maxAllowedBytes)
Sets the maximum number of bytes that MultipartFormItem.writeFile() will be allowed to write. This value may be set immediately before or between calls to MultipartFormItem.writeFile(). If any call to writeFile() exceeds this value, an EOFException will be thrown.

Parameters:
maxAllowedBytes - the maximum number of bytes that MultipartFormItem.writeFile() will be allowed to write. Defaults to 128MB.
See Also:
MultipartFormItem.writeFile(java.io.OutputStream)

getMaximumAllowedBytes

public long getMaximumAllowedBytes()
Gets the maximum number of bytes that MultipartFormItem.writeFile() will be allowed to write.

getNextPart

public MultipartFormItem getNextPart()
                              throws java.io.IOException
Returns the next MultipartStreamItem from the request, or null if no more are present.

Oracle UIX API Reference
Release 2.1.22.0.0
B12196-01

Copyright © 2002,2003, Oracle. All Rights Reserved.