javax.servlet

Class ServletRequestWrapper

public class ServletRequestWrapper extends 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:

Constructor Summary
ServletRequestWrapper(ServletRequest request)
Creates a ServletRequest adaptor wrapping the given request object.
Method Summary
ObjectgetAttribute(String name)
The default behavior of this method is to call getAttribute(String name) on the wrapped request object.
EnumerationgetAttributeNames()
The default behavior of this method is to return getAttributeNames() on the wrapped request object.
StringgetCharacterEncoding()
The default behavior of this method is to return getCharacterEncoding() on the wrapped request object.
intgetContentLength()
The default behavior of this method is to return getContentLength() on the wrapped request object.
StringgetContentType()
The default behavior of this method is to return getContentType() on the wrapped request object.
ServletInputStreamgetInputStream()
The default behavior of this method is to return getInputStream() on the wrapped request object.
StringgetLocalAddr()
The default behavior of this method is to return getLocalAddr() on the wrapped request object.
LocalegetLocale()
The default behavior of this method is to return getLocale() on the wrapped request object.
EnumerationgetLocales()
The default behavior of this method is to return getLocales() on the wrapped request object.
StringgetLocalName()
The default behavior of this method is to return getLocalName() on the wrapped request object.
intgetLocalPort()
The default behavior of this method is to return getLocalPort() on the wrapped request object.
StringgetParameter(String name)
The default behavior of this method is to return getParameter(String name) on the wrapped request object.
MapgetParameterMap()
The default behavior of this method is to return getParameterMap() on the wrapped request object.
EnumerationgetParameterNames()
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.
StringgetProtocol()
The default behavior of this method is to return getProtocol() on the wrapped request object.
BufferedReadergetReader()
The default behavior of this method is to return getReader() on the wrapped request object.
StringgetRealPath(String path)
The default behavior of this method is to return getRealPath(String path) on the wrapped request object.
StringgetRemoteAddr()
The default behavior of this method is to return getRemoteAddr() on the wrapped request object.
StringgetRemoteHost()
The default behavior of this method is to return getRemoteHost() on the wrapped request object.
intgetRemotePort()
The default behavior of this method is to return getRemotePort() on the wrapped request object.
ServletRequestgetRequest()
Return the wrapped request object.
RequestDispatchergetRequestDispatcher(String path)
The default behavior of this method is to return getRequestDispatcher(String path) on the wrapped request object.
StringgetScheme()
The default behavior of this method is to return getScheme() on the wrapped request object.
StringgetServerName()
The default behavior of this method is to return getServerName() on the wrapped request object.
intgetServerPort()
The default behavior of this method is to return getServerPort() on the wrapped request object.
booleanisSecure()
The default behavior of this method is to return isSecure() on the wrapped request object.
voidremoveAttribute(String name)
The default behavior of this method is to call removeAttribute(String name) on the wrapped request object.
voidsetAttribute(String name, Object o)
The default behavior of this method is to return setAttribute(String name, Object o) on the wrapped request object.
voidsetCharacterEncoding(String enc)
The default behavior of this method is to set the character encoding on the wrapped request object.
voidsetRequest(ServletRequest request)
Sets the request object being wrapped.

Constructor Detail

ServletRequestWrapper

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

Throws: java.lang.IllegalArgumentException if the request is null

Method Detail

getAttribute

public Object getAttribute(String name)
The default behavior of this method is to call getAttribute(String name) on the wrapped request object.

getAttributeNames

public Enumeration getAttributeNames()
The default behavior of this method is to return getAttributeNames() on the wrapped request object.

getCharacterEncoding

public String getCharacterEncoding()
The default behavior of this method is to return getCharacterEncoding() on the wrapped request object.

getContentLength

public int getContentLength()
The default behavior of this method is to return getContentLength() on the wrapped request object.

getContentType

public String getContentType()
The default behavior of this method is to return getContentType() on the wrapped request object.

getInputStream

public ServletInputStream getInputStream()
The default behavior of this method is to return getInputStream() on the wrapped request object.

getLocalAddr

public String getLocalAddr()
The default behavior of this method is to return getLocalAddr() on the wrapped request object.

Since: 2.4

getLocale

public Locale getLocale()
The default behavior of this method is to return getLocale() on the wrapped request object.

getLocales

public Enumeration getLocales()
The default behavior of this method is to return getLocales() on the wrapped request object.

getLocalName

public String getLocalName()
The default behavior of this method is to return getLocalName() on the wrapped request object.

Since: 2.4

getLocalPort

public int getLocalPort()
The default behavior of this method is to return getLocalPort() on the wrapped request object.

Since: 2.4

getParameter

public String getParameter(String name)
The default behavior of this method is to return getParameter(String name) on the wrapped request object.

getParameterMap

public Map getParameterMap()
The default behavior of this method is to return getParameterMap() on the wrapped request object.

getParameterNames

public Enumeration getParameterNames()
The default behavior of this method is to return getParameterNames() on the wrapped request object.

getParameterValues

public String[] getParameterValues(String name)
The default behavior of this method is to return getParameterValues(String name) on the wrapped request object.

getProtocol

public String getProtocol()
The default behavior of this method is to return getProtocol() on the wrapped request object.

getReader

public BufferedReader getReader()
The default behavior of this method is to return getReader() on the wrapped request object.

getRealPath

public String getRealPath(String path)
The default behavior of this method is to return getRealPath(String path) on the wrapped request object.

getRemoteAddr

public String getRemoteAddr()
The default behavior of this method is to return getRemoteAddr() on the wrapped request object.

getRemoteHost

public String getRemoteHost()
The default behavior of this method is to return getRemoteHost() on the wrapped request object.

getRemotePort

public int getRemotePort()
The default behavior of this method is to return getRemotePort() on the wrapped request object.

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.

getScheme

public String getScheme()
The default behavior of this method is to return getScheme() on the wrapped request object.

getServerName

public String getServerName()
The default behavior of this method is to return getServerName() on the wrapped request object.

getServerPort

public int getServerPort()
The default behavior of this method is to return getServerPort() on the wrapped request object.

isSecure

public boolean isSecure()
The default behavior of this method is to return isSecure() on the wrapped request object.

removeAttribute

public void removeAttribute(String name)
The default behavior of this method is to call removeAttribute(String name) on the wrapped request object.

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.

setCharacterEncoding

public void setCharacterEncoding(String enc)
The default behavior of this method is to set the character encoding on the wrapped request object.

setRequest

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

Throws: java.lang.IllegalArgumentException if the request is null.

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