planetj.http
Class MultipartRequest

java.lang.Object
  extended byHttpServletRequestWrapper
      extended byplanetj.http.MultipartRequest

public class MultipartRequest
extends HttpServletRequestWrapper

A MultipartRequest object serves as a wrapper around HttpServletRequest objects whose content type is "multipart/form-data". Requests of that type contain information that cannot be retrieved via the normal methods (such as getParameter()). Portions of this class are covered under a copyright by Sun (Copyright (c) 1995-1997 Sun Microsystems, Inc. All Rights Reserved) and are the confidential and proprietary information of Sun Microsystems, Inc. ("Confidential Information"). You shall not disclose such Confidential Information and shall use it only in accordance with the terms of the license agreement you entered into with Sun or else.

See Also:
Serialized Form

Method Summary
static HttpServletRequest createMultipartRequest(HttpServletRequest originalRequest)
          Creates a new MultipartRequest object which wraps the passed HttpServletRequest.
 java.lang.String getParameter(java.lang.String name)
          Gets the parameter with the specified name.
 java.util.Map getParameterMap()
          Returns a Map of the parameters of this request.
 java.util.Enumeration getParameterNames()
          Returns the names of all the parameters in this request.
 java.lang.String[] getParameterValues(java.lang.String name)
          Gets the value of any parameter with the specified name.
 java.lang.StringBuffer getRequestURL()
           
static boolean isMultipartEncoded(HttpServletRequest req)
          Tests if the encoding of the request is set to "multipart/form-data".
static boolean isTooLarge(HttpServletRequest req)
          Tests if the request's size exceeds the maximum allowable size.
 void setCharacterEncoding(java.lang.String arg0)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createMultipartRequest

public static HttpServletRequest createMultipartRequest(HttpServletRequest originalRequest)
                                                 throws CMException
Creates a new MultipartRequest object which wraps the passed HttpServletRequest. This allows the framework and applications to handle requests with multipart encoding in the same fashion as normal requests. This method should not be invoked unless it is known that the passed request has multipart encoding.

Parameters:
originalRequest - An HttpServletRequest (which must have multipart encoding) that will be wrapped in a MultipartRequest.
Returns:
If the passed request is already a MultipartRequest object, then that same object is returned. Otherwise, the parameter is wrapped in a MultipartRequest object which is returned.
Throws:
sli.ccs.fw.exception.RequestTooLarge - Thrown if the passed request was too large to parse.
sli.ccs.fw.exception.MalformedRequestException - Thrown if there was an error parsing the request, or if the request did not have multipart encoding.
CMException

getParameter

public java.lang.String getParameter(java.lang.String name)
Gets the parameter with the specified name. If there is more than one parameter with this name, the "last" such parameter will be returned.

Parameters:
name - The name of the parameter to return.
Returns:
The value of the specified parameter.

getParameterMap

public java.util.Map getParameterMap()
Returns a Map of the parameters of this request. Request parameters are extra information sent with the request. For HTTP servlets, parameters are contained in the query string or posted form data.

Returns:
an immutable Map containing parameter names as keys and parameter values as map values. The keys in the parameter map are of type String. The values in the parameter map are of type String array.

getParameterNames

public java.util.Enumeration getParameterNames()
Returns the names of all the parameters in this request.

Returns:
An Enumeration containing the names of all the parameters in this request

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
Gets the value of any parameter with the specified name.

Parameters:
name - The name of the parameter(s) of interest
Returns:
An array containing the values of all the parameters with the specified name. This may be null if there are no such parameters.

getRequestURL

public java.lang.StringBuffer getRequestURL()
See Also:
javax.servlet.http.HttpServletRequest#getRequestURL()

isMultipartEncoded

public static boolean isMultipartEncoded(HttpServletRequest req)
Tests if the encoding of the request is set to "multipart/form-data".

Parameters:
req - An HttpServletRequest
Returns:
true if the request's encoding is "multipart/form-data" and false otherwise.

isTooLarge

public static boolean isTooLarge(HttpServletRequest req)
Tests if the request's size exceeds the maximum allowable size.

Parameters:
req - An HttpServletRequest
Returns:
true if the request's size exceeds the maximum allowable size, false otherwise.

setCharacterEncoding

public void setCharacterEncoding(java.lang.String arg0)
                          throws java.io.UnsupportedEncodingException
Throws:
java.io.UnsupportedEncodingException
See Also:
javax.servlet.ServletRequest#setCharacterEncoding(String)