org.apache.struts.upload
Class MultipartRequestWrapper

java.lang.Object
  extended byorg.apache.struts.upload.MultipartRequestWrapper

public class MultipartRequestWrapper
extends java.lang.Object

This class functions as a wrapper around HttpServletRequest to provide working getParameter methods for multipart requests. Once Struts requires Servlet 2.3, this class will definately be changed to extend javax.servlet.http.HttpServletRequestWrapper instead of implementing HttpServletRequest. Servlet 2.3 methods are implemented to return null or do nothing if called on. Use getRequest to retrieve the underlying HttpServletRequest object and call on the 2.3 method there, the empty methods are here only so that this will compile with the Servlet 2.3 jar. This class exists temporarily in the process() method of ActionServlet, just before the ActionForward is processed and just after the Action is performed, the request is set back to the original HttpServletRequest object.


Field Summary
protected  java.util.Map parameters
          The parameters for this multipart request
protected  HttpServletRequest request
          The underlying HttpServletRequest
 
Constructor Summary
MultipartRequestWrapper(HttpServletRequest request)
           
 
Method Summary
 java.lang.Object getAttribute(java.lang.String name)
           
 java.util.Enumeration getAttributeNames()
           
 java.lang.String getAuthType()
           
 java.lang.String getCharacterEncoding()
           
 int getContentLength()
           
 java.lang.String getContentType()
           
 java.lang.String getContextPath()
           
 Cookie[] getCookies()
           
 long getDateHeader(java.lang.String name)
           
 java.lang.String getHeader(java.lang.String name)
           
 java.util.Enumeration getHeaderNames()
           
 java.util.Enumeration getHeaders(java.lang.String name)
           
 ServletInputStream getInputStream()
           
 int getIntHeader(java.lang.String name)
           
 java.util.Locale getLocale()
           
 java.util.Enumeration getLocales()
           
 java.lang.String getMethod()
           
 java.lang.String getParameter(java.lang.String name)
          Attempts to get a parameter for this request.
 java.util.Map getParameterMap()
          This method returns null.
 java.util.Enumeration getParameterNames()
          Returns the names of the parameters for this request.
 java.lang.String[] getParameterValues(java.lang.String name)
           
 java.lang.String getPathInfo()
           
 java.lang.String getPathTranslated()
           
 java.lang.String getProtocol()
           
 java.lang.String getQueryString()
           
 java.io.BufferedReader getReader()
           
 java.lang.String getRealPath(java.lang.String path)
           
 java.lang.String getRemoteAddr()
           
 java.lang.String getRemoteHost()
           
 java.lang.String getRemoteUser()
           
 HttpServletRequest getRequest()
          Returns the underlying HttpServletRequest for this wrapper
 RequestDispatcher getRequestDispatcher(java.lang.String path)
           
 java.lang.String getRequestedSessionId()
           
 java.lang.String getRequestURI()
           
 java.lang.StringBuffer getRequestURL()
          This method returns null.
 java.lang.String getScheme()
           
 java.lang.String getServerName()
           
 int getServerPort()
           
 java.lang.String getServletPath()
           
 HttpSession getSession()
           
 HttpSession getSession(boolean create)
           
 java.security.Principal getUserPrincipal()
           
 boolean isRequestedSessionIdFromCookie()
          This method returns false.
 boolean isRequestedSessionIdFromUrl()
           
 boolean isRequestedSessionIdFromURL()
           
 boolean isRequestedSessionIdValid()
           
 boolean isSecure()
           
 boolean isUserInRole(java.lang.String user)
           
 void removeAttribute(java.lang.String name)
           
 void setAttribute(java.lang.String name, java.lang.Object o)
           
 void setCharacterEncoding(java.lang.String encoding)
          This method does nothing.
 void setParameter(java.lang.String name, java.lang.String value)
          Sets a parameter for this request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parameters

protected java.util.Map parameters
The parameters for this multipart request


request

protected HttpServletRequest request
The underlying HttpServletRequest

Constructor Detail

MultipartRequestWrapper

public MultipartRequestWrapper(HttpServletRequest request)
Method Detail

setParameter

public void setParameter(java.lang.String name,
                         java.lang.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 java.lang.String getParameter(java.lang.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


getParameterNames

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


getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)

getRequest

public HttpServletRequest getRequest()
Returns the underlying HttpServletRequest for this wrapper


getAttribute

public java.lang.Object getAttribute(java.lang.String name)

getAttributeNames

public java.util.Enumeration getAttributeNames()

getCharacterEncoding

public java.lang.String getCharacterEncoding()

getContentLength

public int getContentLength()

getContentType

public java.lang.String getContentType()

getInputStream

public ServletInputStream getInputStream()
                                  throws java.io.IOException
Throws:
java.io.IOException

getProtocol

public java.lang.String getProtocol()

getScheme

public java.lang.String getScheme()

getServerName

public java.lang.String getServerName()

getServerPort

public int getServerPort()

getReader

public java.io.BufferedReader getReader()
                                 throws java.io.IOException
Throws:
java.io.IOException

getRemoteAddr

public java.lang.String getRemoteAddr()

getRemoteHost

public java.lang.String getRemoteHost()

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object o)

removeAttribute

public void removeAttribute(java.lang.String name)

getLocale

public java.util.Locale getLocale()

getLocales

public java.util.Enumeration getLocales()

isSecure

public boolean isSecure()

getRequestDispatcher

public RequestDispatcher getRequestDispatcher(java.lang.String path)

getRealPath

public java.lang.String getRealPath(java.lang.String path)

getAuthType

public java.lang.String getAuthType()

getCookies

public Cookie[] getCookies()

getDateHeader

public long getDateHeader(java.lang.String name)

getHeader

public java.lang.String getHeader(java.lang.String name)

getHeaders

public java.util.Enumeration getHeaders(java.lang.String name)

getHeaderNames

public java.util.Enumeration getHeaderNames()

getIntHeader

public int getIntHeader(java.lang.String name)

getMethod

public java.lang.String getMethod()

getPathInfo

public java.lang.String getPathInfo()

getPathTranslated

public java.lang.String getPathTranslated()

getContextPath

public java.lang.String getContextPath()

getQueryString

public java.lang.String getQueryString()

getRemoteUser

public java.lang.String getRemoteUser()

isUserInRole

public boolean isUserInRole(java.lang.String user)

getUserPrincipal

public java.security.Principal getUserPrincipal()

getRequestedSessionId

public java.lang.String getRequestedSessionId()

getRequestURI

public java.lang.String getRequestURI()

getServletPath

public java.lang.String getServletPath()

getSession

public HttpSession getSession(boolean create)

getSession

public HttpSession getSession()

isRequestedSessionIdValid

public boolean isRequestedSessionIdValid()

isRequestedSessionIdFromURL

public boolean isRequestedSessionIdFromURL()

isRequestedSessionIdFromUrl

public boolean isRequestedSessionIdFromUrl()

getParameterMap

public java.util.Map getParameterMap()
This method returns null. To use any Servlet 2.3 methods, call on getRequest() and use that request object. Once Servlet 2.3 is required to build Struts, this will no longer be an issue.


setCharacterEncoding

public void setCharacterEncoding(java.lang.String encoding)
This method does nothing. To use any Servlet 2.3 methods, call on getRequest() and use that request object. Once Servlet 2.3 is required to build Struts, this will no longer be an issue.


getRequestURL

public java.lang.StringBuffer getRequestURL()
This method returns null. To use any Servlet 2.3 methods, call on getRequest() and use that request object. Once Servlet 2.3 is required to build Struts, this will no longer be an issue.


isRequestedSessionIdFromCookie

public boolean isRequestedSessionIdFromCookie()
This method returns false. To use any Servlet 2.3 methods, call on getRequest() and use that request object. Once Servlet 2.3 is required to build Struts, this will no longer be an issue.



Copyright ? 2000-2004 - Apache Software Foundation