org.apache.struts.upload

Class MultipartRequestWrapper

Implemented Interfaces:
HttpServletRequest

public class MultipartRequestWrapper
extends java.lang.Object
implements HttpServletRequest

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 Map
parameters
The parameters for this multipart request
protected HttpServletRequest
request
The underlying HttpServletRequest

Constructor Summary

MultipartRequestWrapper(HttpServletRequest request)

Method Summary

Object
getAttribute(String name)
Enumeration
getAttributeNames()
String
getAuthType()
String
getCharacterEncoding()
int
getContentLength()
String
getContentType()
String
getContextPath()
Cookie[]
getCookies()
long
getDateHeader(String name)
String
getHeader(String name)
Enumeration
getHeaderNames()
Enumeration
getHeaders(String name)
ServletInputStream
getInputStream()
int
getIntHeader(String name)
String
getLocalAddr()
This method returns null.
String
getLocalName()
This method returns null.
int
getLocalPort()
This method returns -1.
Locale
getLocale()
Enumeration
getLocales()
String
getMethod()
String
getParameter(String name)
Attempts to get a parameter for this request.
Map
getParameterMap()
This method returns null.
Enumeration
getParameterNames()
Returns the names of the parameters for this request.
String[]
getParameterValues(String name)
String
getPathInfo()
String
getPathTranslated()
String
getProtocol()
String
getQueryString()
BufferedReader
getReader()
String
getRealPath(String path)
String
getRemoteAddr()
String
getRemoteHost()
int
getRemotePort()
This method returns -1.
String
getRemoteUser()
HttpServletRequest
getRequest()
Returns the underlying HttpServletRequest for this wrapper
RequestDispatcher
getRequestDispatcher(String path)
String
getRequestURI()
StringBuffer
getRequestURL()
This method returns null.
String
getRequestedSessionId()
String
getScheme()
String
getServerName()
int
getServerPort()
String
getServletPath()
HttpSession
getSession()
HttpSession
getSession(boolean create)
Principal
getUserPrincipal()
boolean
isRequestedSessionIdFromCookie()
This method returns false.
boolean
isRequestedSessionIdFromURL()
boolean
isRequestedSessionIdFromUrl()
boolean
isRequestedSessionIdValid()
boolean
isSecure()
boolean
isUserInRole(String user)
void
removeAttribute(String name)
void
setAttribute(String name, Object o)
void
setCharacterEncoding(String encoding)
This method does nothing.
void
setParameter(String name, String value)
Sets a parameter for this request.

Field Details

parameters

protected Map parameters
The parameters for this multipart request


request

protected HttpServletRequest request
The underlying HttpServletRequest

Constructor Details

MultipartRequestWrapper

public MultipartRequestWrapper(HttpServletRequest request)

Method Details

getAttribute

public Object getAttribute(String name)


getAttributeNames

public Enumeration getAttributeNames()


getAuthType

public String getAuthType()


getCharacterEncoding

public String getCharacterEncoding()


getContentLength

public int getContentLength()


getContentType

public String getContentType()


getContextPath

public String getContextPath()


getCookies

public Cookie[] getCookies()


getDateHeader

public long getDateHeader(String name)


getHeader

public String getHeader(String name)


getHeaderNames

public Enumeration getHeaderNames()


getHeaders

public Enumeration getHeaders(String name)


getInputStream

public ServletInputStream getInputStream()
            throws IOException


getIntHeader

public int getIntHeader(String name)


getLocalAddr

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


getLocalName

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


getLocalPort

public int getLocalPort()
This method returns -1. To use any Servlet 2.4 methods, call on getRequest() and use that request object. Once Servlet 2.4 is required to build Struts, this will no longer be an issue.


getLocale

public Locale getLocale()


getLocales

public Enumeration getLocales()


getMethod

public String getMethod()


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


getParameterMap

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


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


getParameterValues

public String[] getParameterValues(String name)


getPathInfo

public String getPathInfo()


getPathTranslated

public String getPathTranslated()


getProtocol

public String getProtocol()


getQueryString

public String getQueryString()


getReader

public BufferedReader getReader()
            throws IOException


getRealPath

public String getRealPath(String path)


getRemoteAddr

public String getRemoteAddr()


getRemoteHost

public String getRemoteHost()


getRemotePort

public int getRemotePort()
This method returns -1. To use any Servlet 2.4 methods, call on getRequest() and use that request object. Once Servlet 2.4 is required to build Struts, this will no longer be an issue.


getRemoteUser

public String getRemoteUser()


getRequest

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


getRequestDispatcher

public RequestDispatcher getRequestDispatcher(String path)


getRequestURI

public String getRequestURI()


getRequestURL

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


getRequestedSessionId

public String getRequestedSessionId()


getScheme

public String getScheme()


getServerName

public String getServerName()


getServerPort

public int getServerPort()


getServletPath

public String getServletPath()


getSession

public HttpSession getSession()


getSession

public HttpSession getSession(boolean create)


getUserPrincipal

public Principal getUserPrincipal()


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.


isRequestedSessionIdFromURL

public boolean isRequestedSessionIdFromURL()


isRequestedSessionIdFromUrl

public boolean isRequestedSessionIdFromUrl()


isRequestedSessionIdValid

public boolean isRequestedSessionIdValid()


isSecure

public boolean isSecure()


isUserInRole

public boolean isUserInRole(String user)


removeAttribute

public void removeAttribute(String name)


setAttribute

public void setAttribute(String name,
                         Object o)


setCharacterEncoding

public void setCharacterEncoding(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.


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.


Copyright B) 2000-2005 - Apache Software Foundation