javax.servlet.ServletRequestWrapper翻译

<!-- ========= START OF TOP NAVBAR ======= --> <!-- -->
JavaTM 2 Platform
Ent. Ed. v1.4
<!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== -->

javax.servlet
Class ServletRequestWrapper


All Implemented Interfaces:
ServletRequest
Direct Known Subclasses:
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. 提供了一种实现ServletRequest接口的便捷方式,开发人员想采用Servlet请求的话, 可以对其子类化。该类实现了包装或装饰模式。方法默认调用经过包装的请求对象。

Since:
v 2.3
See Also:
ServletRequest

<!-- ======== NESTED CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- -->

Constructor Summary
ServletRequestWrapper(ServletRequestrequest)
Creates a ServletRequest adaptor wrapping the given request object. 创建一个ServletRequest适配器,包装指定的请求对象。
<!-- ========== METHOD SUMMARY =========== --> <!-- -->
Method Summary
Object getAttribute(Stringname)
The default behavior of this method is to call getAttribute(String name) on the wrapped request object. 该方法的默认行为是调用经过包装的请求对象的getAttribute(String name)。
Enumeration getAttributeNames()
The default behavior of this method is to return getAttributeNames() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getAttributeNames()。
String getCharacterEncoding()
The default behavior of this method is to return getCharacterEncoding() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getCharacterEncoding()。
int getContentLength()
The default behavior of this method is to return getContentLength() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getContentLength()。
String getContentType()
The default behavior of this method is to return getContentType() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getContentType()。
ServletInputStream getInputStream()
The default behavior of this method is to return getInputStream() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getInputStream()。
String getLocalAddr()
The default behavior of this method is to return getLocalAddr() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getLocalAddr()。
Locale getLocale()
The default behavior of this method is to return getLocale() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getLocale()。
Enumeration getLocales()
The default behavior of this method is to return getLocales() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getLocales()。
String getLocalName()
The default behavior of this method is to return getLocalName() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getLocalName()。
int getLocalPort()
The default behavior of this method is to return getLocalPort() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getLocalPort()。
String getParameter(Stringname)
The default behavior of this method is to return getParameter(String name) on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getParameter(String name)。
Map getParameterMap()
The default behavior of this method is to return getParameterMap() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getParameterMap()。
Enumeration getParameterNames()
The default behavior of this method is to return getParameterNames() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getParameterNames()。
String[] getParameterValues(Stringname)
The default behavior of this method is to return getParameterValues(String name) on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getParameterValues(String name)。
String getProtocol()
The default behavior of this method is to return getProtocol() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getProtocol()。
BufferedReader getReader()
The default behavior of this method is to return getReader() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getReader()。
String getRealPath(Stringpath)
The default behavior of this method is to return getRealPath(String path) on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getRealPath(String path)。
String getRemoteAddr()
The default behavior of this method is to return getRemoteAddr() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getRemoteAddr()。
String getRemoteHost()
The default behavior of this method is to return getRemoteHost() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getRemoteHost()。
int getRemotePort()
The default behavior of this method is to return getRemotePort() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getRemotePort()。
ServletRequest getRequest()
Return the wrapped request object. 返回包装的请求对象。
RequestDispatcher getRequestDispatcher(Stringpath)
The default behavior of this method is to return getRequestDispatcher(String path) on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getRequestDispatcher(String path)。
String getScheme()
The default behavior of this method is to return getScheme() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getScheme()。
String getServerName()
The default behavior of this method is to return getServerName() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getServerName()。
int getServerPort()
The default behavior of this method is to return getServerPort() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getServerPort()。
boolean isSecure()
The default behavior of this method is to return isSecure() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的isSecure()。
void removeAttribute(Stringname)
The default behavior of this method is to call removeAttribute(String name) on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的removeAttribute(String name)。
void setAttribute(Stringname, Objecto)
The default behavior of this method is to return setAttribute(String name, Object o) on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的setAttribute(String name, Object o)。
void setCharacterEncoding(Stringenc)
The default behavior of this method is to set the character encoding on the wrapped request object. 该方法的默认行为是设置经过包装的请求对象的字符编码。
void setRequest(ServletRequestrequest)
Sets the request object being wrapped. 设置被包装的请求对象。
<!-- -->
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

<!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><!-- -->

Constructor Detail
<!-- -->

ServletRequestWrapper

Creates a ServletRequest adaptor wrapping the given request object. 创建一个ServletRequest适配器,包装指定的请求对象。
Throws:
IllegalArgumentException - if the request is null 如果请求为null时抛出
<!-- ============ METHOD DETAIL ========== --> <!-- -->
Method Detail
<!-- -->

getRequest

Return the wrapped request object. 返回包装的请求对象。
<!-- -->

setRequest

Sets the request object being wrapped. 设置被包装的请求对象。
Throws:
IllegalArgumentException - if the request is null. 如果请求为null时抛出。
<!-- -->

getAttribute

The default behavior of this method is to call getAttribute(String name) on the wrapped request object. 该方法的默认行为是调用经过包装的请求对象的getAttribute(String name)。
Specified by:
getAttribute in interface ServletRequest
Parameters:
name - a String specifying the name of the attribute String,表示属性名称
Returns:
an Object containing the value of the attribute, or null if the attribute does not exist Object,表示属性值,如果该属性不存在,返回null
<!-- -->

getAttributeNames

The default behavior of this method is to return getAttributeNames() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getAttributeNames()。
Specified by:
getAttributeNames in interface ServletRequest
Returns:
an Enumeration of strings containing the names of the request's attributes 字符串的枚举,表示请求属性的名称
<!-- -->

getCharacterEncoding

The default behavior of this method is to return getCharacterEncoding() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getCharacterEncoding()。
Specified by:
getCharacterEncoding in interface ServletRequest
Returns:
a String containing the name of the chararacter encoding, or null if the request does not specify a character encoding String,表示字符编码名称,如果请求未指定字符编码,返回null
<!-- -->

setCharacterEncoding

The default behavior of this method is to set the character encoding on the wrapped request object. 该方法的默认行为是设置经过包装的请求对象的字符编码。
Specified by:
setCharacterEncoding in interface ServletRequest
Parameters:
enc - a String containing the name of the chararacter encoding. String,表示字符编码名称。
Throws:
UnsupportedEncodingException - if this is not a valid encoding 如果这是一个无效的编码时抛出
<!-- -->

getContentLength

 
The default behavior of this method is to return getContentLength() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getContentLength()。
Specified by:
getContentLength in interface ServletRequest
Returns:
an integer containing the length of the request body or -1 if the length is not known 整数,表示请求体的长度,长度未知则为-1
<!-- -->

getContentType

The default behavior of this method is to return getContentType() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getContentType()。
Specified by:
getContentType in interface ServletRequest
Returns:
a String containing the name of the MIME type of the request, or null if the type is not known String,表示请求的MIME类型名称,如果类型未知,返回null
<!-- -->

getInputStream

The default behavior of this method is to return getInputStream() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getInputStream()。
Specified by:
getInputStream in interface ServletRequest
Returns:
a ServletInputStream object containing the body of the request ServletInputStream对象,表示请求体
Throws:
IOException - if an input or output exception occurred 如果发生输入输出异常时抛出
<!-- -->

getParameter

The default behavior of this method is to return getParameter(String name) on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getParameter(String name)。
Specified by:
getParameter in interface ServletRequest
Parameters:
name - a String specifying the name of the parameter String,表示参数名称
Returns:
a String representing the single value of the parameter String,表示参数的唯一值
See Also:
ServletRequest.getParameterValues(java.lang.String)
<!-- -->

getParameterMap

The default behavior of this method is to return getParameterMap() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getParameterMap()。
Specified by:
getParameterMap in interface 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. 一个不变的java.util.Map,key为参数名称,map值为参数值。 在参数map中key为String类型,值为String数组类型。
<!-- -->

getParameterNames

The default behavior of this method is to return getParameterNames() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getParameterNames()。
Specified by:
getParameterNames in interface ServletRequest
Returns:
an Enumeration of String objects, each String containing the name of a request parameter; or an empty Enumeration if the request has no parameters String对象的枚举,每一个String为请求参数的名称;如果请求不含参数,返回空枚举
<!-- -->

getParameterValues

The default behavior of this method is to return getParameterValues(String name) on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getParameterValues(String name)。
Specified by:
getParameterValues in interface ServletRequest
Parameters:
name - a String containing the name of the parameter whose value is requested String,请求值的参数名称
Returns:
an array of String objects containing the parameter's values String对象数组,表示参数的值
See Also:
ServletRequest.getParameter(java.lang.String)
<!-- -->

getProtocol

The default behavior of this method is to return getProtocol() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getProtocol()。
Specified by:
getProtocol in interface ServletRequest
Returns:
a String containing the protocol name and version number String,表示协议名称和版本号
<!-- -->

getScheme

The default behavior of this method is to return getScheme() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getScheme()。
Specified by:
getScheme in interface ServletRequest
Returns:
a String containing the name of the scheme used to make this request String,表示用来生成请求的模式名称
<!-- -->

getServerName

The default behavior of this method is to return getServerName() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getServerName()。
Specified by:
getServerName in interface ServletRequest
Returns:
a String containing the name of the server String,表示服务器名称
<!-- -->

getServerPort

 
The default behavior of this method is to return getServerPort() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getServerPort()。
Specified by:
getServerPort in interface ServletRequest
Returns:
an integer specifying the port number 整数,表示端口号
<!-- -->

getReader

The default behavior of this method is to return getReader() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getReader()。
Specified by:
getReader in interface ServletRequest
Returns:
a BufferedReader containing the body of the request BufferedReader,表示请求体
Throws:
IOException - if an input or output exception occurred 如果发生输入输出异常时抛出
See Also:
ServletRequest.getInputStream()
<!-- -->

getRemoteAddr

The default behavior of this method is to return getRemoteAddr() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getRemoteAddr()。
Specified by:
getRemoteAddr in interface ServletRequest
Returns:
a String containing the IP address of the client that sent the request String,表示发送请求的客户端IP地址
<!-- -->

getRemoteHost

The default behavior of this method is to return getRemoteHost() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getRemoteHost()。
Specified by:
getRemoteHost in interface ServletRequest
Returns:
a String containing the fully qualified name of the client String,表示客户端全名称
<!-- -->

setAttribute

The default behavior of this method is to return setAttribute(String name, Object o) on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的setAttribute(String name, Object o)。
Specified by:
setAttribute in interface ServletRequest
Parameters:
name - a String specifying the name of the attribute String,表示属性名称
o - the Object to be stored 要保存的Object
<!-- -->

removeAttribute

The default behavior of this method is to call removeAttribute(String name) on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的removeAttribute(String name)。
Specified by:
removeAttribute in interface ServletRequest
Parameters:
name - a String specifying the name of the attribute to remove String,指定要删除的属性名称
<!-- -->

getLocale

The default behavior of this method is to return getLocale() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getLocale()。
Specified by:
getLocale in interface ServletRequest
Returns:
the preferred Locale for the client 客户端采用的Locale
<!-- -->

getLocales

The default behavior of this method is to return getLocales() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getLocales()。
Specified by:
getLocales in interface ServletRequest
Returns:
an Enumeration of preferred Locale objects for the client 客户端采用的Locale对象枚举
<!-- -->

isSecure

 
The default behavior of this method is to return isSecure() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的isSecure()。
Specified by:
isSecure in interface ServletRequest
Returns:
a boolean indicating if the request was made using a secure channel 布尔值,表示请求是否使用安全通道发出
<!-- -->

getRequestDispatcher

The default behavior of this method is to return getRequestDispatcher(String path) on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getRequestDispatcher(String path)。
Specified by:
getRequestDispatcher in interface ServletRequest
Parameters:
path - a String specifying the pathname to the resource. If it is relative, it must be relative against the current servlet. String,表示资源路径名。如果是相对的,必须相对于当前servlet。
Returns:
a RequestDispatcher object that acts as a wrapper for the resource at the specified path, or null if the servlet container cannot return a RequestDispatcher RequestDispatcher对象,作为指定路径的资源包装器,如果servlet容器不能返回RequestDispatcher, 那么返回null
See Also:
RequestDispatcher , ServletContext.getRequestDispatcher(java.lang.String)
<!-- -->

getRealPath

The default behavior of this method is to return getRealPath(String path) on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getRealPath(String path)。
Specified by:
getRealPath in interface ServletRequest
<!-- -->

getRemotePort

 
The default behavior of this method is to return getRemotePort() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getRemotePort()。
Specified by:
getRemotePort in interface ServletRequest
Since:
2.4
<!-- -->

getLocalName

The default behavior of this method is to return getLocalName() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getLocalName()。
Specified by:
getLocalName in interface ServletRequest
Returns:
a String containing the host name of the IP on which the request was received. String,表示收到请求的IP主机名。
Since:
2.4
<!-- -->

getLocalAddr

The default behavior of this method is to return getLocalAddr() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getLocalAddr()。
Specified by:
getLocalAddr in interface ServletRequest
Returns:
a String containing the IP address on which the request was received. String,表示收到请求的IP地址。
Since:
2.4
<!-- -->

getLocalPort

 
The default behavior of this method is to return getLocalPort() on the wrapped request object. 该方法的默认行为是返回经过包装的请求对象的getLocalPort()。
Specified by:
getLocalPort in i
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值