org.apache.struts.upload
Class MultipartRequestWrapper

java.lang.Object
  extended by javax.servlet.ServletRequestWrapper
      extended by javax.servlet.http.HttpServletRequestWrapper
          extended by org.apache.struts.upload.MultipartRequestWrapper
All Implemented Interfaces:
HttpServletRequest, ServletRequest

public class MultipartRequestWrapper
extends HttpServletRequestWrapper

This class functions as a wrapper around HttpServletRequest to provide working getParameter methods for multipart requests.


Field Summary
protected  Map parameters
           The parameters for this multipart request
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Constructor Summary
MultipartRequestWrapper(HttpServletRequest request)
           
 
Method Summary
 String getParameter(String name)
           Attempts to get a parameter for this request.
 Map getParameterMap()
           Combines the parameters stored here with those in the underlying request.
 Enumeration getParameterNames()
           Returns the names of the parameters for this request.
 String[] getParameterValues(String name)
           Returns the values of a parameter in this request.
 void setParameter(String name, String value)
           Sets a parameter for this request.
 
Methods inherited from class javax.servlet.http.HttpServletRequestWrapper
getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, 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, setCharacterEncoding, setRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, 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, setCharacterEncoding
 

Field Detail

parameters

protected Map parameters

The parameters for this multipart request

Constructor Detail

MultipartRequestWrapper

public MultipartRequestWrapper(HttpServletRequest request)
Method Detail

setParameter

public void setParameter(String name,
                         String value)

Sets a parameter for this request. The parameter is actually separate from the request parameters, but calling on the getParameter() methods of this class will work as if they weren't.


getParameter

public String getParameter(String name)

Attempts to get a parameter for this request. It first looks in the underlying HttpServletRequest object for the parameter, and if that doesn't exist it looks for the parameters retrieved from the multipart request

Specified by:
getParameter in interface ServletRequest
Overrides:
getParameter in class ServletRequestWrapper

getParameterNames

public Enumeration getParameterNames()

Returns the names of the parameters for this request. The enumeration consists of the normal request parameter names plus the parameters read from the multipart request

Specified by:
getParameterNames in interface ServletRequest
Overrides:
getParameterNames in class ServletRequestWrapper

getParameterValues

public String[] getParameterValues(String name)

Returns the values of a parameter in this request. It first looks in the underlying HttpServletRequest object for the parameter, and if that doesn't exist it looks for the parameter retrieved from the multipart request.

Specified by:
getParameterValues in interface ServletRequest
Overrides:
getParameterValues in class ServletRequestWrapper

getParameterMap

public Map getParameterMap()

Combines the parameters stored here with those in the underlying request. If paramater values in the underlying request take precedence over those stored here.

Specified by:
getParameterMap in interface ServletRequest
Overrides:
getParameterMap in class ServletRequestWrapper


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.