planetj.http
Class MultipartRequest

java.lang.Object
  |
  +--javax.servlet.ServletRequestWrapper
        |
        +--javax.servlet.http.HttpServletRequestWrapper
              |
              +--planetj.http.MultipartRequest
All Implemented Interfaces:
javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest

public class MultipartRequest
extends javax.servlet.http.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.


Field Summary
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Method Summary
static javax.servlet.http.HttpServletRequest createMultipartRequest(javax.servlet.http.HttpServletRequest originalRequest)
          Creates a new MultipartRequest object which wraps the passed HttpServletRequest.
 String getParameter(String name)
          Gets the parameter with the specified name.
 Map getParameterMap()
          Returns a Map of the parameters of this request.
 Enumeration getParameterNames()
          Returns the names of all the parameters in this request.
 String[] getParameterValues(String name)
          Gets the value of any parameter with the specified name.
 StringBuffer getRequestURL()
           
static boolean isMultipartEncoded(javax.servlet.http.HttpServletRequest req)
          Tests if the encoding of the request is set to "multipart/form-data".
static boolean isTooLarge(javax.servlet.http.HttpServletRequest req)
          Tests if the request's size exceeds the maximum allowable size.
 void setCharacterEncoding(String arg0)
           
 
Methods inherited from class javax.servlet.http.HttpServletRequestWrapper
getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getServletPath, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole
 
Methods inherited from class javax.servlet.ServletRequestWrapper
getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocale, getLocales, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRequest, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setRequest
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.ServletRequest
getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocale, getLocales, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute
 

Method Detail

createMultipartRequest

public static javax.servlet.http.HttpServletRequest createMultipartRequest(javax.servlet.http.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 String getParameter(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.

Specified by:
getParameter in interface javax.servlet.ServletRequest
Overrides:
getParameter in class javax.servlet.ServletRequestWrapper
Parameters:
name - The name of the parameter to return.
Returns:
The value of the specified parameter.

getParameterMap

public 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.

Specified by:
getParameterMap in interface javax.servlet.ServletRequest
Overrides:
getParameterMap in class javax.servlet.ServletRequestWrapper
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 Enumeration getParameterNames()
Returns the names of all the parameters in this request.

Specified by:
getParameterNames in interface javax.servlet.ServletRequest
Overrides:
getParameterNames in class javax.servlet.ServletRequestWrapper
Returns:
An Enumeration containing the names of all the parameters in this request

getParameterValues

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

Specified by:
getParameterValues in interface javax.servlet.ServletRequest
Overrides:
getParameterValues in class javax.servlet.ServletRequestWrapper
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 StringBuffer getRequestURL()
Specified by:
getRequestURL in interface javax.servlet.http.HttpServletRequest
Overrides:
getRequestURL in class javax.servlet.http.HttpServletRequestWrapper
See Also:
HttpServletRequest.getRequestURL()

isMultipartEncoded

public static boolean isMultipartEncoded(javax.servlet.http.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(javax.servlet.http.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(String arg0)
                          throws UnsupportedEncodingException
Specified by:
setCharacterEncoding in interface javax.servlet.ServletRequest
Overrides:
setCharacterEncoding in class javax.servlet.ServletRequestWrapper
UnsupportedEncodingException
See Also:
ServletRequest.setCharacterEncoding(String)