javax.servlet.ServletResponseWrapper翻译

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

javax.servlet
Class ServletResponseWrapper


All Implemented Interfaces:
ServletResponse
Direct Known Subclasses:
HttpServletResponseWrapper
public class ServletResponseWrapper extends Object implements ServletResponse

Provides a convenient implementation of the ServletResponse interface that can be subclassed by developers wishing to adapt the response from a Servlet. This class implements the Wrapper or Decorator pattern. Methods default to calling through to the wrapped response object. 提供了一种实现ServletResponse接口的便捷方式,开发人员想采用来自Servlet的响应的话, 可以对其子类化。该类实现了包装或装饰模式。方法默认调用经过包装的响应对象。

Since:
v 2.3
Version:
$Version$
Author:
Various
See Also:
ServletResponse

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

Constructor Summary
ServletResponseWrapper(ServletResponseresponse)
Creates a ServletResponse adaptor wrapping the given response object. 创建一个ServletResponse适配器,包装指定的响应对象。
<!-- ========== METHOD SUMMARY =========== --> <!-- -->
Method Summary
void flushBuffer()
The default behavior of this method is to call flushBuffer() on the wrapped response object. 该方法的默认行为是调用经过包装的响应对象的flushBuffer()。
int getBufferSize()
The default behavior of this method is to return getBufferSize() on the wrapped response object. 该方法的默认行为是返回经过包装的响应对象的getBufferSize()。
String getCharacterEncoding()
The default behavior of this method is to return getCharacterEncoding() on the wrapped response object. 该方法的默认行为是返回经过包装的响应对象的getCharacterEncoding()。
String getContentType()
The default behavior of this method is to return getContentType() on the wrapped response object. 该方法的默认行为是返回经过包装的响应对象的getContentType()。
Locale getLocale()
The default behavior of this method is to return getLocale() on the wrapped response object. 该方法的默认行为是返回经过包装的响应对象的getLocale()。
ServletOutputStream getOutputStream()
The default behavior of this method is to return getOutputStream() on the wrapped response object. 该方法的默认行为是返回经过包装的响应对象的getOutputStream()。
ServletResponse getResponse()
Return the wrapped ServletResponse object. 返回经过包装的ServletResponse对象。
PrintWriter getWriter()
The default behavior of this method is to return getWriter() on the wrapped response object. 该方法的默认行为是返回经过包装的响应对象的getWriter()。
boolean isCommitted()
The default behavior of this method is to return isCommitted() on the wrapped response object. 该方法的默认行为是返回经过包装的响应对象的isCommitted()。
void reset()
The default behavior of this method is to call reset() on the wrapped response object. 该方法的默认行为是调用经过包装的响应对象的reset()。
void resetBuffer()
The default behavior of this method is to call resetBuffer() on the wrapped response object. 该方法的默认行为是调用经过包装的响应对象的resetBuffer()。
void setBufferSize(intsize)
The default behavior of this method is to call setBufferSize(int size) on the wrapped response object. 该方法的默认行为是调用经过包装的响应对象的setBufferSize(int size)。
void setCharacterEncoding(Stringcharset)
The default behavior of this method is to call setCharacterEncoding(String charset) on the wrapped response object. 该方法的默认行为是调用经过包装的响应对象的setCharacterEncoding(String charset)。
void setContentLength(intlen)
The default behavior of this method is to call setContentLength(int len) on the wrapped response object. 该方法的默认行为是调用经过包装的响应对象的setContentLength(int len)。
void setContentType(Stringtype)
The default behavior of this method is to call setContentType(String type) on the wrapped response object. 该方法的默认行为是调用经过包装的响应对象的setContentType(String type)。
void setLocale(Localeloc)
The default behavior of this method is to call setLocale(Locale loc) on the wrapped response object. 该方法的默认行为是调用经过包装的响应对象的setLocale(Locale loc)。
void setResponse(ServletResponseresponse)
Sets the response 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
<!-- -->

ServletResponseWrapper

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

getResponse

Return the wrapped ServletResponse object. 返回经过包装的ServletResponse对象。
<!-- -->

setResponse

Sets the response being wrapped. 设置要包装的响应。
Throws:
IllegalArgumentException - if the response is null. 如果响应为null时抛出。
<!-- -->

setCharacterEncoding

The default behavior of this method is to call setCharacterEncoding(String charset) on the wrapped response object. 该方法的默认行为是调用经过包装的响应对象的setCharacterEncoding(String charset)。
Specified by:
setCharacterEncoding in interface ServletResponse
Parameters:
charset - a String specifying only the character set defined by IANA Character Sets (http://www.iana.org/assignments/character-sets) String,只表示由IANA字符集(http://www.iana.org/assignments/character-sets)定义的字符集
Since:
2.4
See Also:
#setLocale
<!-- -->

getCharacterEncoding

The default behavior of this method is to return getCharacterEncoding() on the wrapped response object. 该方法的默认行为是返回经过包装的响应对象的getCharacterEncoding()。
Specified by:
getCharacterEncoding in interface ServletResponse
Returns:
a String specifying the name of the character encoding, for example, UTF-8 String,表示字符编码名称,比如UTF-8
<!-- -->

getOutputStream

The default behavior of this method is to return getOutputStream() on the wrapped response object. 该方法的默认行为是返回经过包装的响应对象的getOutputStream()。
Specified by:
getOutputStream in interface ServletResponse
Returns:
a ServletOutputStream for writing binary data 输出二进制数据的ServletOutputStream
Throws:
IOException - if an input or output exception occurred 如果发生输入输出异常时抛出
See Also:
ServletResponse.getWriter()
<!-- -->

getWriter

The default behavior of this method is to return getWriter() on the wrapped response object. 该方法的默认行为是返回经过包装的响应对象的getWriter()。
Specified by:
getWriter in interface ServletResponse
Returns:
a PrintWriter object that can return character data to the client PrintWriter对象,可以返回客户端的字符数据
Throws:
IOException - if an input or output exception occurred 如果发生输入输出异常时抛出
See Also:
ServletResponse.getOutputStream() , ServletResponse.setCharacterEncoding(java.lang.String)
<!-- -->

setContentLength

 
The default behavior of this method is to call setContentLength(int len) on the wrapped response object. 该方法的默认行为是调用经过包装的响应对象的setContentLength(int len)。
Specified by:
setContentLength in interface ServletResponse
Parameters:
len - an integer specifying the length of the content being returned to the client; sets the Content-Length header 整数,表示返回给客户端的内容长度;设置Content-Length头
<!-- -->

setContentType

The default behavior of this method is to call setContentType(String type) on the wrapped response object. 该方法的默认行为是调用经过包装的响应对象的setContentType(String type)。
Specified by:
setContentType in interface ServletResponse
Parameters:
type - a String specifying the MIME type of the content String,表示内容的MIME类型
See Also:
ServletResponse.setLocale(java.util.Locale) , ServletResponse.setCharacterEncoding(java.lang.String) , ServletResponse.getOutputStream() , ServletResponse.getWriter()
<!-- -->

getContentType

The default behavior of this method is to return getContentType() on the wrapped response object. 该方法的默认行为是返回经过包装的响应对象的getContentType()。
Specified by:
getContentType in interface ServletResponse
Returns:
a String specifying the content type, for example, text/html; charset=UTF-8, or null String,表示内容类型,比如text/html; charset=UTF-8或者为null
Since:
2.4
<!-- -->

setBufferSize

 
The default behavior of this method is to call setBufferSize(int size) on the wrapped response object. 该方法的默认行为是调用经过包装的响应对象的setBufferSize(int size)。
Specified by:
setBufferSize in interface ServletResponse
Parameters:
size - the preferred buffer size 采用的缓存大小
See Also:
ServletResponse.getBufferSize() , ServletResponse.flushBuffer() , ServletResponse.isCommitted() , ServletResponse.reset()
<!-- -->

getBufferSize

 
The default behavior of this method is to return getBufferSize() on the wrapped response object. 该方法的默认行为是返回经过包装的响应对象的getBufferSize()。
Specified by:
getBufferSize in interface ServletResponse
Returns:
the actual buffer size used 实际使用的缓存大小
See Also:
ServletResponse.setBufferSize(int) , ServletResponse.flushBuffer() , ServletResponse.isCommitted() , ServletResponse.reset()
<!-- -->

flushBuffer

The default behavior of this method is to call flushBuffer() on the wrapped response object. 该方法的默认行为是调用经过包装的响应对象的flushBuffer()。
Specified by:
flushBuffer in interface ServletResponse
Throws:
IOException
See Also:
ServletResponse.setBufferSize(int) , ServletResponse.getBufferSize() , ServletResponse.isCommitted() , ServletResponse.reset()
<!-- -->

isCommitted

 
The default behavior of this method is to return isCommitted() on the wrapped response object. 该方法的默认行为是返回经过包装的响应对象的isCommitted()。
Specified by:
isCommitted in interface ServletResponse
Returns:
a boolean indicating if the response has been committed 布尔值,表示响应是否被提交
See Also:
ServletResponse.setBufferSize(int) , ServletResponse.getBufferSize() , ServletResponse.flushBuffer() , ServletResponse.reset()
<!-- -->

reset

 
The default behavior of this method is to call reset() on the wrapped response object. 该方法的默认行为是调用经过包装的响应对象的reset()。
Specified by:
reset in interface ServletResponse
See Also:
ServletResponse.setBufferSize(int) , ServletResponse.getBufferSize() , ServletResponse.flushBuffer() , ServletResponse.isCommitted()
<!-- -->

resetBuffer

 
The default behavior of this method is to call resetBuffer() on the wrapped response object. 该方法的默认行为是调用经过包装的响应对象的resetBuffer()。
Specified by:
resetBuffer in interface ServletResponse
See Also:
ServletResponse.setBufferSize(int) , ServletResponse.getBufferSize() , ServletResponse.isCommitted() , ServletResponse.reset()
<!-- -->

setLocale

The default behavior of this method is to call setLocale(Locale loc) on the wrapped response object. 该方法的默认行为是调用经过包装的响应对象的setLocale(Locale loc)。
Specified by:
setLocale in interface ServletResponse
Parameters:
loc - the locale of the response 响应的locale
See Also:
ServletResponse.getLocale() , ServletResponse.setContentType(java.lang.String) , ServletResponse.setCharacterEncoding(java.lang.String)
<!-- -->

getLocale

The default behavior of this method is to return getLocale() on the wrapped response object. 该方法的默认行为是返回经过包装的响应对象的getLocale()。
Specified by:
getLocale in interface ServletResponse
See Also:
ServletResponse.setLocale(java.util.Locale)
<!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <!-- -->
JavaTM 2 Platform
Ent. Ed. v1.4
<!-- ======== END OF BOTTOM NAVBAR ======= --> Submit a bug or feature

Copyright 2003 Sun Microsystems, Inc. All rights reserved.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值