<!-- -->
| JavaTM 2 Platform Ent. Ed. v1.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES <!-- if(window==top) { document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> All Classes <noscript></noscript> | |||||||||
SUMMARY:NESTED|FIELD|CONSTR|METHOD | DETAIL:FIELD|CONSTR|METHOD |
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 | |
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 |
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 interfaceServletResponse
-
-
-
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 interfaceServletResponse
-
-
-
Returns:
-
a
String
specifying the name of the character encoding, for example,UTF-8
String,表示字符编码名称,比如UTF-8
-
a
getOutputStream
- The default behavior of this method is to return getOutputStream() on the wrapped response object. 该方法的默认行为是返回经过包装的响应对象的getOutputStream()。
-
-
Specified by:
-
getOutputStream
in interfaceServletResponse
-
-
-
Returns:
-
a
ServletOutputStream
for writing binary data 输出二进制数据的ServletOutputStream
Throws:
-
IOException
- if an input or output exception occurred 如果发生输入输出异常时抛出
See Also:
-
ServletResponse.getWriter()
-
a
getWriter
- The default behavior of this method is to return getWriter() on the wrapped response object. 该方法的默认行为是返回经过包装的响应对象的getWriter()。
-
-
Specified by:
-
getWriter
in interfaceServletResponse
-
-
-
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)
-
a
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 interfaceServletResponse
-
-
-
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 interfaceServletResponse
-
-
-
Parameters:
-
type
- aString
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 interfaceServletResponse
-
-
-
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
-
a
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 interfaceServletResponse
-
-
-
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 interfaceServletResponse
-
-
-
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 interfaceServletResponse
-
-
-
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 interfaceServletResponse
-
-
-
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 interfaceServletResponse
-
-
-
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 interfaceServletResponse
-
-
-
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 interfaceServletResponse
-
-
-
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 interfaceServletResponse
-
-
-
See Also:
-
ServletResponse.setLocale(java.util.Locale)
-
<!-- -->
| JavaTM 2 Platform Ent. Ed. v1.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES <!-- if(window==top) { document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> All Classes <noscript></noscript> | |||||||||
SUMMARY:NESTED|FIELD|CONSTR|METHOD | DETAIL:FIELD|CONSTR|METHOD |
Copyright 2003 Sun Microsystems, Inc. All rights reserved.