java.lang.Object | +--javax.servlet.ServletRequestWrapper
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.
ServletRequest
ServletRequestWrapper(ServletRequest request) Creates a ServletRequest adaptor wrapping the given request object. |
getAttribute(java.lang.String name) The default behavior of this method is to call getAttribute(String name) on the wrapped request object. | |
getAttributeNames() The default behavior of this method is to return getAttributeNames() on the wrapped request object. | |
getCharacterEncoding() The default behavior of this method is to return getCharacterEncoding() on the wrapped request object. | |
getContentLength() The default behavior of this method is to return getContentLength() on the wrapped request object. | |
getContentType() The default behavior of this method is to return getContentType() on the wrapped request object. | |
getInputStream() The default behavior of this method is to return getInputStream() on the wrapped request object. | |
getLocale() The default behavior of this method is to return getLocale() on the wrapped request object. | |
getLocales() The default behavior of this method is to return getLocales() on the wrapped request object. | |
getParameter(java.lang.String name) The default behavior of this method is to return getParameter(String name) on the wrapped request object. | |
getParameterMap() The default behavior of this method is to return getParameterMap() on the wrapped request object. | |
getParameterNames() The default behavior of this method is to return getParameterNames() on the wrapped request object. | |
getParameterValues(java.lang.String name) The default behavior of this method is to return getParameterValues(String name) on the wrapped request object. | |
getProtocol() The default behavior of this method is to return getProtocol() on the wrapped request object. | |
getReader() The default behavior of this method is to return getReader() on the wrapped request object. | |
getRealPath(java.lang.String path) The default behavior of this method is to return getRealPath(String path) on the wrapped request object. | |
getRemoteAddr() The default behavior of this method is to return getRemoteAddr() on the wrapped request object. | |
getRemoteHost() The default behavior of this method is to return getRemoteHost() on the wrapped request object. | |
getRequest() Return the wrapped request object. | |
getRequestDispatcher(java.lang.String path) The default behavior of this method is to return getRequestDispatcher(String path) on the wrapped request object. | |
getScheme() The default behavior of this method is to return getScheme() on the wrapped request object. | |
getServerName() The default behavior of this method is to return getServerName() on the wrapped request object. | |
getServerPort() The default behavior of this method is to return getServerPort() on the wrapped request object. | |
isSecure() The default behavior of this method is to return isSecure() on the wrapped request object. | |
removeAttribute(java.lang.String name) The default behavior of this method is to call removeAttribute(String name) on the wrapped request object. | |
setAttribute(java.lang.String name, java.lang.Object o) The default behavior of this method is to return setAttribute(String name, Object o) on the wrapped request object. | |
setCharacterEncoding(java.lang.String enc) The default behavior of this method is to set the character encoding on the wrapped request object. | |
setRequest(ServletRequest request) Sets the request object being wrapped. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
publicServletRequestWrapper(ServletRequest request)
java.lang.IllegalArgumentException
- if the request is nullpublicServletRequestgetRequest()
public voidsetRequest(ServletRequest request)
java.lang.IllegalArgumentException
- if the request is null.public java.lang.ObjectgetAttribute(java.lang.String name)
getAttribute
in interfaceServletRequest
javax.servlet.ServletRequest
name
- aString
specifying the name of the attributeObject
containing the value of the attribute, ornull
ifthe attribute does not existpublic java.util.EnumerationgetAttributeNames()
getAttributeNames
in interfaceServletRequest
javax.servlet.ServletRequest
Enumeration
of strings containing the names of the request's attributespublic java.lang.StringgetCharacterEncoding()
getCharacterEncoding
in interfaceServletRequest
javax.servlet.ServletRequest
String
containing the name of the chararacter encoding, ornull
if the request does not specify a character encodingpublic voidsetCharacterEncoding(java.lang.String enc) throws java.io.UnsupportedEncodingException
setCharacterEncoding
in interfaceServletRequest
javax.servlet.ServletRequest
a
-String
containing the name of the chararacter encoding.java.io.UnsupportedEncodingException
- if this is not a valid encodingpublic intgetContentLength()
getContentLength
in interfaceServletRequest
javax.servlet.ServletRequest
public java.lang.StringgetContentType()
getContentType
in interfaceServletRequest
javax.servlet.ServletRequest
String
containing the name of the MIME type of the request, or null if the type is not knownpublicServletInputStreamgetInputStream() throws java.io.IOException
getInputStream
in interfaceServletRequest
javax.servlet.ServletRequest
ServletInputStream
object containing the body of the requestjava.lang.IllegalStateException
- if theServletRequest.getReader()
method has already been called for this requestjava.io.IOException
- if an input or output exception occurredpublic java.lang.StringgetParameter(java.lang.String name)
getParameter
in interfaceServletRequest
javax.servlet.ServletRequest
name
- aString
specifying the name of the parameterString
representing the single value of the parameterServletRequest.getParameterValues(java.lang.String)
public java.util.MapgetParameterMap()
getParameterMap
in interfaceServletRequest
javax.servlet.ServletRequest
public java.util.EnumerationgetParameterNames()
getParameterNames
in interfaceServletRequest
javax.servlet.ServletRequest
Enumeration
ofString
objects, eachString
containing the name of a request parameter; or an emptyEnumeration
if therequest has no parameterspublic java.lang.String[]getParameterValues(java.lang.String name)
getParameterValues
in interfaceServletRequest
javax.servlet.ServletRequest
name
- aString
containing the name of the parameter whose value is requestedString
objects containing the parameter's valuesServletRequest.getParameter(java.lang.String)
public java.lang.StringgetProtocol()
getProtocol
in interfaceServletRequest
javax.servlet.ServletRequest
String
containing the protocol name and version numberpublic java.lang.StringgetScheme()
getScheme
in interfaceServletRequest
javax.servlet.ServletRequest
String
containing the name of the scheme used to make this requestpublic java.lang.StringgetServerName()
getServerName
in interfaceServletRequest
javax.servlet.ServletRequest
String
containing the name of the server to which the request was sentpublic intgetServerPort()
getServerPort
in interfaceServletRequest
javax.servlet.ServletRequest
public java.io.BufferedReadergetReader() throws java.io.IOException
getReader
in interfaceServletRequest
javax.servlet.ServletRequest
BufferedReader
containing the body of the requestjava.io.UnsupportedEncodingException
- if the character set encoding used is not supported and the text cannot be decodedjava.lang.IllegalStateException
- ifServletRequest.getInputStream()
method has been called on this requestjava.io.IOException
- if an input or output exception occurredServletRequest.getInputStream()
public java.lang.StringgetRemoteAddr()
getRemoteAddr
in interfaceServletRequest
javax.servlet.ServletRequest
String
containing the IP address of the client that sent the requestpublic java.lang.StringgetRemoteHost()
getRemoteHost
in interfaceServletRequest
javax.servlet.ServletRequest
String
containing the fully qualified name of the clientpublic voidsetAttribute(java.lang.String name, java.lang.Object o)
setAttribute
in interfaceServletRequest
javax.servlet.ServletRequest
name
- aString
specifying the name of the attributeo
- theObject
to be storedpublic voidremoveAttribute(java.lang.String name)
removeAttribute
in interfaceServletRequest
javax.servlet.ServletRequest
name
- aString
specifying the name of the attribute to removepublic java.util.LocalegetLocale()
getLocale
in interfaceServletRequest
javax.servlet.ServletRequest
Locale
for the clientpublic java.util.EnumerationgetLocales()
getLocales
in interfaceServletRequest
javax.servlet.ServletRequest
Enumeration
of preferredLocale
objects for the clientpublic booleanisSecure()
isSecure
in interfaceServletRequest
javax.servlet.ServletRequest
publicRequestDispatchergetRequestDispatcher(java.lang.String path)
getRequestDispatcher
in interfaceServletRequest
javax.servlet.ServletRequest
path
- aString
specifying the pathname to the resourceRequestDispatcher
object that acts as a wrapper for the resource at the specified pathRequestDispatcher
,ServletContext.getRequestDispatcher(java.lang.String)
public java.lang.StringgetRealPath(java.lang.String path)
getRealPath
in interfaceServletRequest