javax.servlet

Class ServletRequestWrapper

Implemented Interfaces:
ServletRequest
Known Direct Subclasses:
HttpServletRequestWrapper

public class ServletRequestWrapper
extends java.lang.Object
implements ServletRequest

Provides a convenient implementation of the ServletRequest interface that can be subclassed by developers wishing to adapt the request to a Servlet. This class implements the Wrapper or Decorator pattern. Methods default to calling through to the wrapped request object.
Since:
v 2.3
See Also:
ServletRequest

Constructor Summary

ServletRequestWrapper(ServletRequest request)
Creates a ServletRequest adaptor wrapping the given request object.

Method Summary

Object
getAttribute(String name)
The default behavior of this method is to call getAttribute(String name) on the wrapped request object.
Enumeration
getAttributeNames()
The default behavior of this method is to return getAttributeNames() on the wrapped request object.
String
getCharacterEncoding()
The default behavior of this method is to return getCharacterEncoding() on the wrapped request object.
int
getContentLength()
The default behavior of this method is to return getContentLength() on the wrapped request object.
String
getContentType()
The default behavior of this method is to return getContentType() on the wrapped request object.
ServletInputStream
getInputStream()
The default behavior of this method is to return getInputStream() on the wrapped request object.
String
getLocalAddr()
The default behavior of this method is to return getLocalAddr() on the wrapped request object.
String
getLocalName()
The default behavior of this method is to return getLocalName() on the wrapped request object.
int
getLocalPort()
The default behavior of this method is to return getLocalPort() on the wrapped request object.
Locale
getLocale()
The default behavior of this method is to return getLocale() on the wrapped request object.
Enumeration
getLocales()
The default behavior of this method is to return getLocales() on the wrapped request object.
String
getParameter(String name)
The default behavior of this method is to return getParameter(String name) on the wrapped request object.
Map
getParameterMap()
The default behavior of this method is to return getParameterMap() on the wrapped request object.
Enumeration
getParameterNames()
The default behavior of this method is to return getParameterNames() on the wrapped request object.
String[]
getParameterValues(String name)
The default behavior of this method is to return getParameterValues(String name) on the wrapped request object.
String
getProtocol()
The default behavior of this method is to return getProtocol() on the wrapped request object.
BufferedReader
getReader()
The default behavior of this method is to return getReader() on the wrapped request object.
String
getRealPath(String path)
The default behavior of this method is to return getRealPath(String path) on the wrapped request object.
String
getRemoteAddr()
The default behavior of this method is to return getRemoteAddr() on the wrapped request object.
String
getRemoteHost()
The default behavior of this method is to return getRemoteHost() on the wrapped request object.
int
getRemotePort()
The default behavior of this method is to return getRemotePort() on the wrapped request object.
ServletRequest
getRequest()
Return the wrapped request object.
RequestDispatcher
getRequestDispatcher(String path)
The default behavior of this method is to return getRequestDispatcher(String path) on the wrapped request object.
String
getScheme()
The default behavior of this method is to return getScheme() on the wrapped request object.
String
getServerName()
The default behavior of this method is to return getServerName() on the wrapped request object.
int
getServerPort()
The default behavior of this method is to return getServerPort() on the wrapped request object.
boolean
isSecure()
The default behavior of this method is to return isSecure() on the wrapped request object.
void
removeAttribute(String name)
The default behavior of this method is to call removeAttribute(String name) on the wrapped request object.
void
setAttribute(String name, Object o)
The default behavior of this method is to return setAttribute(String name, Object o) on the wrapped request object.
void
setCharacterEncoding(String enc)
The default behavior of this method is to set the character encoding on the wrapped request object.
void
setRequest(ServletRequest request)
Sets the request object being wrapped.

Constructor Details

ServletRequestWrapper

public ServletRequestWrapper(ServletRequest request)
Creates a ServletRequest adaptor wrapping the given request object.

Method Details

getAttribute

public Object getAttribute(String name)
The default behavior of this method is to call getAttribute(String name) on the wrapped request object.
Specified by:
getAttribute in interface ServletRequest

getAttributeNames

public Enumeration getAttributeNames()
The default behavior of this method is to return getAttributeNames() on the wrapped request object.
Specified by:
getAttributeNames in interface ServletRequest

getCharacterEncoding

public String getCharacterEncoding()
The default behavior of this method is to return getCharacterEncoding() on the wrapped request object.
Specified by:
getCharacterEncoding in interface ServletRequest

getContentLength

public int getContentLength()
The default behavior of this method is to return getContentLength() on the wrapped request object.
Specified by:
getContentLength in interface ServletRequest

getContentType

public String getContentType()
The default behavior of this method is to return getContentType() on the wrapped request object.
Specified by:
getContentType in interface ServletRequest

getInputStream

public ServletInputStream getInputStream()
            throws IOException
The default behavior of this method is to return getInputStream() on the wrapped request object.
Specified by:
getInputStream in interface ServletRequest

getLocalAddr

public String getLocalAddr()
The default behavior of this method is to return getLocalAddr() on the wrapped request object.
Specified by:
getLocalAddr in interface ServletRequest
Since:
2.4

getLocalName

public String getLocalName()
The default behavior of this method is to return getLocalName() on the wrapped request object.
Specified by:
getLocalName in interface ServletRequest
Since:
2.4

getLocalPort

public int getLocalPort()
The default behavior of this method is to return getLocalPort() on the wrapped request object.
Specified by:
getLocalPort in interface ServletRequest
Since:
2.4

getLocale

public Locale getLocale()
The default behavior of this method is to return getLocale() on the wrapped request object.
Specified by:
getLocale in interface ServletRequest

getLocales

public Enumeration getLocales()
The default behavior of this method is to return getLocales() on the wrapped request object.
Specified by:
getLocales in interface ServletRequest

getParameter

public String getParameter(String name)
The default behavior of this method is to return getParameter(String name) on the wrapped request object.
Specified by:
getParameter in interface ServletRequest

getParameterMap

public Map getParameterMap()
The default behavior of this method is to return getParameterMap() on the wrapped request object.
Specified by:
getParameterMap in interface ServletRequest

getParameterNames

public Enumeration getParameterNames()
The default behavior of this method is to return getParameterNames() on the wrapped request object.
Specified by:
getParameterNames in interface ServletRequest

getParameterValues

public String[] getParameterValues(String name)
The default behavior of this method is to return getParameterValues(String name) on the wrapped request object.
Specified by:
getParameterValues in interface ServletRequest

getProtocol

public String getProtocol()
The default behavior of this method is to return getProtocol() on the wrapped request object.
Specified by:
getProtocol in interface ServletRequest

getReader

public BufferedReader getReader()
            throws IOException
The default behavior of this method is to return getReader() on the wrapped request object.
Specified by:
getReader in interface ServletRequest

getRealPath

public String getRealPath(String path)
The default behavior of this method is to return getRealPath(String path) on the wrapped request object.
Specified by:
getRealPath in interface ServletRequest

getRemoteAddr

public String getRemoteAddr()
The default behavior of this method is to return getRemoteAddr() on the wrapped request object.
Specified by:
getRemoteAddr in interface ServletRequest

getRemoteHost

public String getRemoteHost()
The default behavior of this method is to return getRemoteHost() on the wrapped request object.
Specified by:
getRemoteHost in interface ServletRequest

getRemotePort

public int getRemotePort()
The default behavior of this method is to return getRemotePort() on the wrapped request object.
Specified by:
getRemotePort in interface ServletRequest
Since:
2.4

getRequest

public ServletRequest getRequest()
Return the wrapped request object.

getRequestDispatcher

public RequestDispatcher getRequestDispatcher(String path)
The default behavior of this method is to return getRequestDispatcher(String path) on the wrapped request object.
Specified by:
getRequestDispatcher in interface ServletRequest

getScheme

public String getScheme()
The default behavior of this method is to return getScheme() on the wrapped request object.
Specified by:
getScheme in interface ServletRequest

getServerName

public String getServerName()
The default behavior of this method is to return getServerName() on the wrapped request object.
Specified by:
getServerName in interface ServletRequest

getServerPort

public int getServerPort()
The default behavior of this method is to return getServerPort() on the wrapped request object.
Specified by:
getServerPort in interface ServletRequest

isSecure

public boolean isSecure()
The default behavior of this method is to return isSecure() on the wrapped request object.
Specified by:
isSecure in interface ServletRequest

removeAttribute

public void removeAttribute(String name)
The default behavior of this method is to call removeAttribute(String name) on the wrapped request object.
Specified by:
removeAttribute in interface ServletRequest

setAttribute

public void setAttribute(String name,
                         Object o)
The default behavior of this method is to return setAttribute(String name, Object o) on the wrapped request object.
Specified by:
setAttribute in interface ServletRequest

setCharacterEncoding

public void setCharacterEncoding(String enc)
            throws java.io.UnsupportedEncodingException
The default behavior of this method is to set the character encoding on the wrapped request object.
Specified by:
setCharacterEncoding in interface ServletRequest

setRequest

public void setRequest(ServletRequest request)
Sets the request object being wrapped.

Copyright © 1999-2002 The Apache Software Foundation. All Rights Reserved.