|
|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: 嵌套 | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 | ||||||||
javax.servlet Class ServletRequestWrapper
java.lang.Objectjavax.servlet.ServletRequestWrapper
- 所有已实现的接口:
- ServletRequest
- 直接已知子类:
- HttpServletRequestWrapper
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.
- 从以下版本开始:
- v 2.3
- 另请参见:
ServletRequest
| 构造器摘要 | |
|---|---|
ServletRequestWrapper(ServletRequest request)
Creates a ServletRequest adaptor wrapping the given request object. |
|
| 方法摘要 | |
|---|---|
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. |
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 |
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. |
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. |
| 类方法继承 java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 构造器详细信息 |
|---|
ServletRequestWrapper
public ServletRequestWrapper(ServletRequest request)
- Creates a ServletRequest adaptor wrapping the given request object.
- 抛出异常:
IllegalArgumentException- if the request is null
| 方法详细信息 |
|---|
getRequest
public ServletRequest getRequest()
- Return the wrapped request object.
setRequest
public void setRequest(ServletRequest request)
- Sets the request object being wrapped.
- 抛出异常:
IllegalArgumentException- if the request is null.
getAttribute
public Object getAttribute(String name)
- The default behavior of this method is to call getAttribute(String name)
on the wrapped request object.
- 规范说明:
getAttributein interfaceServletRequest
- 参数:
name- aStringspecifying the name of the attribute- 返回:
- an
Objectcontaining the value of the attribute, ornullif the attribute does not exist
getAttributeNames
public Enumeration getAttributeNames()
- The default behavior of this method is to return getAttributeNames()
on the wrapped request object.
- 规范说明:
getAttributeNamesin interfaceServletRequest
- 返回:
- an
Enumerationof strings containing the names of the request's attributes
getCharacterEncoding
public String getCharacterEncoding()
- The default behavior of this method is to return getCharacterEncoding()
on the wrapped request object.
- 规范说明:
getCharacterEncodingin interfaceServletRequest
- 返回:
- a
Stringcontaining the name of the character encoding, ornullif the request does not specify a character encoding
setCharacterEncoding
public void setCharacterEncoding(String enc) throws UnsupportedEncodingException
- The default behavior of this method is to set the character encoding
on the wrapped request object.
- 规范说明:
setCharacterEncodingin interfaceServletRequest
- 参数:
enc-Stringcontaining the name of the character encoding.- 抛出异常:
UnsupportedEncodingException- if this ServletRequest is still in a state where a character encoding may be set, but the specified encoding is invalid
getContentLength
public int getContentLength()
- The default behavior of this method is to return getContentLength()
on the wrapped request object.
- 规范说明:
getContentLengthin interfaceServletRequest
- 返回:
- an integer containing the length of the request body or -1 if the length is not known
getContentType
public String getContentType()
- The default behavior of this method is to return getContentType()
on the wrapped request object.
- 规范说明:
getContentTypein interfaceServletRequest
- 返回:
- a
Stringcontaining the name of the MIME type of the request, or null if the type is not known
getInputStream
public ServletInputStream getInputStream() throws IOException
- The default behavior of this method is to return getInputStream()
on the wrapped request object.
- 规范说明:
getInputStreamin interfaceServletRequest
- 返回:
- a
ServletInputStreamobject containing the body of the request - 抛出异常:
IOException- if an input or output exception occurred
getParameter
public String getParameter(String name)
- The default behavior of this method is to return getParameter(String name)
on the wrapped request object.
- 规范说明:
getParameterin interfaceServletRequest
- 参数:
name- aStringspecifying the name of the parameter- 返回:
- a
Stringrepresenting the single value of the parameter - 另请参见:
ServletRequest.getParameterValues(java.lang.String)
getParameterMap
public Map getParameterMap()
- The default behavior of this method is to return getParameterMap()
on the wrapped request object.
- 规范说明:
getParameterMapin interfaceServletRequest
- 返回:
- 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 Enumeration getParameterNames()
- The default behavior of this method is to return getParameterNames()
on the wrapped request object.
- 规范说明:
getParameterNamesin interfaceServletRequest
- 返回:
- an
EnumerationofStringobjects, eachStringcontaining the name of a request parameter; or an emptyEnumerationif the request has no parameters
getParameterValues
public String[] getParameterValues(String name)
- The default behavior of this method is to return getParameterValues(String name)
on the wrapped request object.
- 规范说明:
getParameterValuesin interfaceServletRequest
- 参数:
name- aStringcontaining the name of the parameter whose value is requested- 返回:
- an array of
Stringobjects containing the parameter's values - 另请参见:
ServletRequest.getParameter(java.lang.String)
getProtocol
public String getProtocol()
- The default behavior of this method is to return getProtocol()
on the wrapped request object.
- 规范说明:
getProtocolin interfaceServletRequest
- 返回:
- a
Stringcontaining the protocol name and version number
getScheme
public String getScheme()
- The default behavior of this method is to return getScheme()
on the wrapped request object.
- 规范说明:
getSchemein interfaceServletRequest
- 返回:
- a
Stringcontaining the name of the scheme used to make this request
getServerName
public String getServerName()
- The default behavior of this method is to return getServerName()
on the wrapped request object.
- 规范说明:
getServerNamein interfaceServletRequest
- 返回:
- a
Stringcontaining the name of the server
getServerPort
public int getServerPort()
- The default behavior of this method is to return getServerPort()
on the wrapped request object.
- 规范说明:
getServerPortin interfaceServletRequest
- 返回:
- an integer specifying the port number
getReader
public BufferedReader getReader() throws IOException
- The default behavior of this method is to return getReader()
on the wrapped request object.
- 规范说明:
getReaderin interfaceServletRequest
- 返回:
- a
BufferedReadercontaining the body of the request - 抛出异常:
IOException- if an input or output exception occurred- 另请参见:
ServletRequest.getInputStream()
getRemoteAddr
public String getRemoteAddr()
- The default behavior of this method is to return getRemoteAddr()
on the wrapped request object.
- 规范说明:
getRemoteAddrin interfaceServletRequest
- 返回:
- a
Stringcontaining the IP address of the client that sent the request
getRemoteHost
public String getRemoteHost()
- The default behavior of this method is to return getRemoteHost()
on the wrapped request object.
- 规范说明:
getRemoteHostin interfaceServletRequest
- 返回:
- a
Stringcontaining the fully qualified name of the client
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.
- 规范说明:
setAttributein interfaceServletRequest
- 参数:
name- aStringspecifying the name of the attributeo- theObjectto be stored
removeAttribute
public void removeAttribute(String name)
- The default behavior of this method is to call removeAttribute(String name)
on the wrapped request object.
- 规范说明:
removeAttributein interfaceServletRequest
- 参数:
name- aStringspecifying the name of the attribute to remove
getLocale
public Locale getLocale()
- The default behavior of this method is to return getLocale()
on the wrapped request object.
- 规范说明:
getLocalein interfaceServletRequest
- 返回:
- the preferred
Localefor the client
getLocales
public Enumeration getLocales()
- The default behavior of this method is to return getLocales()
on the wrapped request object.
- 规范说明:
getLocalesin interfaceServletRequest
- 返回:
- an
Enumerationof preferredLocaleobjects for the client
isSecure
public boolean isSecure()
- The default behavior of this method is to return isSecure()
on the wrapped request object.
- 规范说明:
isSecurein interfaceServletRequest
- 返回:
- a boolean indicating if the request was made using a secure channel
getRequestDispatcher
public RequestDispatcher getRequestDispatcher(String path)
- The default behavior of this method is to return getRequestDispatcher(String path)
on the wrapped request object.
- 规范说明:
getRequestDispatcherin interfaceServletRequest
- 参数:
path- aStringspecifying the pathname to the resource. If it is relative, it must be relative against the current servlet.- 返回:
- a
RequestDispatcherobject that acts as a wrapper for the resource at the specified path, ornullif the servlet container cannot return aRequestDispatcher - 另请参见:
RequestDispatcher,ServletContext.getRequestDispatcher(java.lang.String)
getRealPath
public String getRealPath(String path)
- The default behavior of this method is to return getRealPath(String path)
on the wrapped request object.
- 规范说明:
getRealPathin interfaceServletRequest
getRemotePort
public int getRemotePort()
- The default behavior of this method is to return
getRemotePort() on the wrapped request object.
- 规范说明:
getRemotePortin interfaceServletRequest
- 返回:
- an integer specifying the port number
- 从以下版本开始:
- 2.4
getLocalName
public String getLocalName()
- The default behavior of this method is to return
getLocalName() on the wrapped request object.
- 规范说明:
getLocalNamein interfaceServletRequest
- 返回:
- a
Stringcontaining the host name of the IP on which the request was received. - 从以下版本开始:
- 2.4
getLocalAddr
public String getLocalAddr()
- The default behavior of this method is to return
getLocalAddr() on the wrapped request object.
- 规范说明:
getLocalAddrin interfaceServletRequest
- 返回:
- a
Stringcontaining the IP address on which the request was received. - 从以下版本开始:
- 2.4
getLocalPort
public int getLocalPort()
- The default behavior of this method is to return
getLocalPort() on the wrapped request object.
- 规范说明:
getLocalPortin interfaceServletRequest
- 返回:
- an integer specifying the port number
- 从以下版本开始:
- 2.4
|
|
Java EE 5 SDK 深圳电信培训中心.徐海蛟老师. |
||||||||
| 上一个类 下一个类 | 框架 无框架 | ||||||||
| 摘要: 嵌套 | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 | ||||||||
提交错误或意见
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.
javax.servlet.ServletRequestWrapper