Movatterモバイル変換


[0]ホーム

URL:


         


Class ServletRequestWrapper

java.lang.Object  |  +--javax.servlet.ServletRequestWrapper
All Implemented Interfaces:
ServletRequest
Direct Known Subclasses:
HttpServletRequestWrapper

public classServletRequestWrapper
extends java.lang.Object
implementsServletRequest

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

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
 

ServletRequestWrapper

publicServletRequestWrapper(ServletRequest request)
Creates a ServletRequest adaptor wrapping the given request object.
Throws:
java.lang.IllegalArgumentException - if the request is null

getRequest

publicServletRequestgetRequest()
Return the wrapped request object.

setRequest

public voidsetRequest(ServletRequest request)
Sets the request object being wrapped.
Throws:
java.lang.IllegalArgumentException - if the request is null.

getAttribute

public java.lang.ObjectgetAttribute(java.lang.String name)
The default behavior of this method is to call getAttribute(String name) on the wrapped request object.
Specified by:
getAttribute in interfaceServletRequest
Following copied from interface:javax.servlet.ServletRequest
Parameters:
name - aString specifying the name of the attribute
Returns:
anObject containing the value of the attribute, ornull ifthe attribute does not exist

getAttributeNames

public java.util.EnumerationgetAttributeNames()
The default behavior of this method is to return getAttributeNames() on the wrapped request object.
Specified by:
getAttributeNames in interfaceServletRequest
Following copied from interface:javax.servlet.ServletRequest
Returns:
anEnumeration of strings containing the names of the request's attributes

getCharacterEncoding

public java.lang.StringgetCharacterEncoding()
The default behavior of this method is to return getCharacterEncoding() on the wrapped request object.
Specified by:
getCharacterEncoding in interfaceServletRequest
Following copied from interface:javax.servlet.ServletRequest
Returns:
aString containing the name of the chararacter encoding, ornullif the request does not specify a character encoding

setCharacterEncoding

public voidsetCharacterEncoding(java.lang.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 interfaceServletRequest
Following copied from interface:javax.servlet.ServletRequest
Parameters:
a -String containing the name of the chararacter encoding.
Throws:
java.io.UnsupportedEncodingException - if this is not a valid encoding

getContentLength

public intgetContentLength()
The default behavior of this method is to return getContentLength() on the wrapped request object.
Specified by:
getContentLength in interfaceServletRequest
Following copied from interface:javax.servlet.ServletRequest
Returns:
an integer containing the length of the request body or -1 if the length is not known

getContentType

public java.lang.StringgetContentType()
The default behavior of this method is to return getContentType() on the wrapped request object.
Specified by:
getContentType in interfaceServletRequest
Following copied from interface:javax.servlet.ServletRequest
Returns:
aString containing the name of the MIME type of the request, or null if the type is not known

getInputStream

publicServletInputStreamgetInputStream()                                  throws java.io.IOException
The default behavior of this method is to return getInputStream() on the wrapped request object.
Specified by:
getInputStream in interfaceServletRequest
Following copied from interface:javax.servlet.ServletRequest
Returns:
aServletInputStream object containing the body of the request
Throws:
java.lang.IllegalStateException - if theServletRequest.getReader() method has already been called for this request
java.io.IOException - if an input or output exception occurred

getParameter

public java.lang.StringgetParameter(java.lang.String name)
The default behavior of this method is to return getParameter(String name) on the wrapped request object.
Specified by:
getParameter in interfaceServletRequest
Following copied from interface:javax.servlet.ServletRequest
Parameters:
name - aString specifying the name of the parameter
Returns:
aString representing the single value of the parameter
See Also:
ServletRequest.getParameterValues(java.lang.String)

getParameterMap

public java.util.MapgetParameterMap()
The default behavior of this method is to return getParameterMap() on the wrapped request object.
Specified by:
getParameterMap in interfaceServletRequest
Following copied from interface:javax.servlet.ServletRequest
Returns:
an immutable java.util.Map containing parameter names as keys and parameter values as map values. The keys in the parameter map are of type String. The values in the parameter map are of type String array.

getParameterNames

public java.util.EnumerationgetParameterNames()
The default behavior of this method is to return getParameterNames() on the wrapped request object.
Specified by:
getParameterNames in interfaceServletRequest
Following copied from interface:javax.servlet.ServletRequest
Returns:
anEnumeration ofStringobjects, eachString containing the name of a request parameter; or an emptyEnumeration if therequest has no parameters

getParameterValues

public java.lang.String[]getParameterValues(java.lang.String name)
The default behavior of this method is to return getParameterValues(String name) on the wrapped request object.
Specified by:
getParameterValues in interfaceServletRequest
Following copied from interface:javax.servlet.ServletRequest
Parameters:
name - aString containing the name of the parameter whose value is requested
Returns:
an array ofString objects containing the parameter's values
See Also:
ServletRequest.getParameter(java.lang.String)

getProtocol

public java.lang.StringgetProtocol()
The default behavior of this method is to return getProtocol() on the wrapped request object.
Specified by:
getProtocol in interfaceServletRequest
Following copied from interface:javax.servlet.ServletRequest
Returns:
aString containing the protocol name and version number

getScheme

public java.lang.StringgetScheme()
The default behavior of this method is to return getScheme() on the wrapped request object.
Specified by:
getScheme in interfaceServletRequest
Following copied from interface:javax.servlet.ServletRequest
Returns:
aString containing the name of the scheme used to make this request

getServerName

public java.lang.StringgetServerName()
The default behavior of this method is to return getServerName() on the wrapped request object.
Specified by:
getServerName in interfaceServletRequest
Following copied from interface:javax.servlet.ServletRequest
Returns:
aString containing the name of the server to which the request was sent

getServerPort

public intgetServerPort()
The default behavior of this method is to return getServerPort() on the wrapped request object.
Specified by:
getServerPort in interfaceServletRequest
Following copied from interface:javax.servlet.ServletRequest
Returns:
an integer specifying the port number

getReader

public java.io.BufferedReadergetReader()                                 throws java.io.IOException
The default behavior of this method is to return getReader() on the wrapped request object.
Specified by:
getReader in interfaceServletRequest
Following copied from interface:javax.servlet.ServletRequest
Returns:
aBufferedReadercontaining the body of the request
Throws:
java.io.UnsupportedEncodingException - if the character set encoding used is not supported and the text cannot be decoded
java.lang.IllegalStateException - ifServletRequest.getInputStream() method has been called on this request
java.io.IOException - if an input or output exception occurred
See Also:
ServletRequest.getInputStream()

getRemoteAddr

public java.lang.StringgetRemoteAddr()
The default behavior of this method is to return getRemoteAddr() on the wrapped request object.
Specified by:
getRemoteAddr in interfaceServletRequest
Following copied from interface:javax.servlet.ServletRequest
Returns:
aString containing the IP address of the client that sent the request

getRemoteHost

public java.lang.StringgetRemoteHost()
The default behavior of this method is to return getRemoteHost() on the wrapped request object.
Specified by:
getRemoteHost in interfaceServletRequest
Following copied from interface:javax.servlet.ServletRequest
Returns:
aString containing the fully qualified name of the client

setAttribute

public voidsetAttribute(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.
Specified by:
setAttribute in interfaceServletRequest
Following copied from interface:javax.servlet.ServletRequest
Parameters:
name - aString specifying the name of the attribute
o - theObject to be stored

removeAttribute

public voidremoveAttribute(java.lang.String name)
The default behavior of this method is to call removeAttribute(String name) on the wrapped request object.
Specified by:
removeAttribute in interfaceServletRequest
Following copied from interface:javax.servlet.ServletRequest
Parameters:
name - aString specifying the name of the attribute to remove

getLocale

public java.util.LocalegetLocale()
The default behavior of this method is to return getLocale() on the wrapped request object.
Specified by:
getLocale in interfaceServletRequest
Following copied from interface:javax.servlet.ServletRequest
Returns:
the preferredLocale for the client

getLocales

public java.util.EnumerationgetLocales()
The default behavior of this method is to return getLocales() on the wrapped request object.
Specified by:
getLocales in interfaceServletRequest
Following copied from interface:javax.servlet.ServletRequest
Returns:
anEnumeration of preferredLocale objects for the client

isSecure

public booleanisSecure()
The default behavior of this method is to return isSecure() on the wrapped request object.
Specified by:
isSecure in interfaceServletRequest
Following copied from interface:javax.servlet.ServletRequest
Returns:
a boolean indicating if the request was made using a secure channel

getRequestDispatcher

publicRequestDispatchergetRequestDispatcher(java.lang.String path)
The default behavior of this method is to return getRequestDispatcher(String path) on the wrapped request object.
Specified by:
getRequestDispatcher in interfaceServletRequest
Following copied from interface:javax.servlet.ServletRequest
Parameters:
path - aString specifying the pathname to the resource
Returns:
aRequestDispatcher object that acts as a wrapper for the resource at the specified path
See Also:
RequestDispatcher,ServletContext.getRequestDispatcher(java.lang.String)

getRealPath

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

         


[8]ページ先頭

©2009-2025 Movatter.jp