|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
javax.servlet Class ServletResponseWrapper
java.lang.Objectjavax.servlet.ServletResponseWrapper
- All Implemented Interfaces:
- ServletResponse
- Direct Known Subclasses:
- HttpServletResponseWrapper
public class ServletResponseWrapper
- extends Object
- implements ServletResponse
提供 ServletResponse 接口的便捷实现,希望根据 Servlet 适配响应的开发人员可以子类化该接口。此类实现 Wrapper 或 Decorator 模式。默认情况下,方法通过包装的响应对象调用。
| since |
| |
| See also | javax.servlet.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.
- Since:
- v 2.3
- Author:
- Various
- See Also:
ServletResponse
| Constructor Summary | |
|---|---|
ServletResponseWrapper(ServletResponse response)
Creates a ServletResponse adaptor wrapping the given response object. |
|
| Method Summary | |
|---|---|
void |
flushBuffer()
The default behavior of this method is to call flushBuffer() on the wrapped response object. |
int |
getBufferSize()
The default behavior of this method is to return getBufferSize() on the wrapped response object. |
String |
getCharacterEncoding()
The default behavior of this method is to return getCharacterEncoding() on the wrapped response object. |
String |
getContentType()
The default behavior of this method is to return getContentType() on the wrapped response object. |
Locale |
getLocale()
The default behavior of this method is to return getLocale() on the wrapped response object. |
ServletOutputStream |
getOutputStream()
The default behavior of this method is to return getOutputStream() on the wrapped response object. |
ServletResponse |
getResponse()
Return the wrapped ServletResponse object. |
PrintWriter |
getWriter()
The default behavior of this method is to return getWriter() on the wrapped response object. |
boolean |
isCommitted()
The default behavior of this method is to return isCommitted() on the wrapped response object. |
void |
reset()
The default behavior of this method is to call reset() on the wrapped response object. |
void |
resetBuffer()
The default behavior of this method is to call resetBuffer() on the wrapped response object. |
void |
setBufferSize(int size)
The default behavior of this method is to call setBufferSize(int size) on the wrapped response object. |
void |
setCharacterEncoding(String charset)
The default behavior of this method is to call setCharacterEncoding(String charset) on the wrapped response object. |
void |
setContentLength(int len)
The default behavior of this method is to call setContentLength(int len) on the wrapped response object. |
void |
setContentType(String type)
The default behavior of this method is to call setContentType(String type) on the wrapped response object. |
void |
setLocale(Locale loc)
The default behavior of this method is to call setLocale(Locale loc) on the wrapped response object. |
void |
setResponse(ServletResponse response)
Sets the response being wrapped. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public
ServletResponseWrapper(ServletResponse response)
创建包装给定响应对象的 ServletResponse 适配器。
| Throws | IllegalArgumentException: 如果 response 为 null |
ServletResponseWrapper
public ServletResponseWrapper(ServletResponse response)
- Creates a ServletResponse adaptor wrapping the given response object.
- Throws:
IllegalArgumentException- if the response is null.
| Method Detail |
|---|
public ServletResponse
getResponse()
返回包装的 ServletResponse 对象。
英文文档:
getResponse
public ServletResponse getResponse()
- Return the wrapped ServletResponse object.
public void
setResponse(ServletResponse response)
设置将被包装的响应。
| Throws | IllegalArgumentException: 如果 response 为 null |
setResponse
public void setResponse(ServletResponse response)
- Sets the response being wrapped.
- Throws:
IllegalArgumentException- if the response is null.
public void
setCharacterEncoding(String charset)
此方法的默认行为是对包装的响应对象调用 setCharacterEncoding(String charset)。
| since | 2.4 |
setCharacterEncoding
public void setCharacterEncoding(String charset)
- The default behavior of this method is to call setCharacterEncoding(String charset)
on the wrapped response object.
- Specified by:
setCharacterEncodingin interfaceServletResponse
- Parameters:
charset- a String specifying only the character set defined by IANA Character Sets (http://www.iana.org/assignments/character-sets)- Since:
- 2.4
- See Also:
#setLocale
public String
getCharacterEncoding()
此方法的默认行为是返回对包装的响应对象调用 getCharacterEncoding() 的结果。
英文文档:
getCharacterEncoding
public String getCharacterEncoding()
- The default behavior of this method is to return getCharacterEncoding()
on the wrapped response object.
- Specified by:
getCharacterEncodingin interfaceServletResponse
- Returns:
- a
Stringspecifying the name of the character encoding, for example,UTF-8
public ServletOutputStream
getOutputStream() throws java.io.IOException
此方法的默认行为是返回对包装的响应对象调用 getOutputStream() 的结果。
英文文档:
getOutputStream
public ServletOutputStream getOutputStream() throws IOException
- The default behavior of this method is to return getOutputStream()
on the wrapped response object.
- Specified by:
getOutputStreamin interfaceServletResponse
- Returns:
- a
ServletOutputStreamfor writing binary data - Throws:
IOException- if an input or output exception occurred- See Also:
ServletResponse.getWriter()
public java.io.PrintWriter
getWriter() throws java.io.IOException
此方法的默认行为是返回对包装的响应对象调用 getWriter() 的结果。
英文文档:
getWriter
public PrintWriter getWriter() throws IOException
- The default behavior of this method is to return getWriter()
on the wrapped response object.
- Specified by:
getWriterin interfaceServletResponse
- Returns:
- a
PrintWriterobject that can return character data to the client - Throws:
IOException- if an input or output exception occurred- See Also:
ServletResponse.getOutputStream(),ServletResponse.setCharacterEncoding(java.lang.String)
public void
setContentLength(int len)
此方法的默认行为是对包装的响应对象调用 setContentLength(int len)。
英文文档:
setContentLength
public void setContentLength(int len)
- The default behavior of this method is to call setContentLength(int len)
on the wrapped response object.
- Specified by:
setContentLengthin interfaceServletResponse
- Parameters:
len- an integer specifying the length of the content being returned to the client; sets the Content-Length header
public void
setContentType(String type)
此方法的默认行为是对包装的响应对象调用 setContentType(String type)。
英文文档:
setContentType
public void setContentType(String type)
- The default behavior of this method is to call setContentType(String type)
on the wrapped response object.
- Specified by:
setContentTypein interfaceServletResponse
- Parameters:
type- aStringspecifying the MIME type of the content- See Also:
ServletResponse.setLocale(java.util.Locale),ServletResponse.setCharacterEncoding(java.lang.String),ServletResponse.getOutputStream(),ServletResponse.getWriter()
public String
getContentType()
此方法的默认行为是返回对包装的响应对象调用 getContentType() 的结果。
| since | 2.4 |
getContentType
public String getContentType()
- The default behavior of this method is to return getContentType()
on the wrapped response object.
- Specified by:
getContentTypein interfaceServletResponse
- Returns:
- a
Stringspecifying the content type, for example,text/html; charset=UTF-8, or null - Since:
- 2.4
public void
setBufferSize(int size)
此方法的默认行为是对包装的响应对象调用 setBufferSize(int size)。
英文文档:
setBufferSize
public void setBufferSize(int size)
- The default behavior of this method is to call setBufferSize(int size)
on the wrapped response object.
- Specified by:
setBufferSizein interfaceServletResponse
- Parameters:
size- the preferred buffer size- See Also:
ServletResponse.getBufferSize(),ServletResponse.flushBuffer(),ServletResponse.isCommitted(),ServletResponse.reset()
public int
getBufferSize()
此方法的默认行为是返回对包装的响应对象调用 getBufferSize() 的结果。
英文文档:
getBufferSize
public int getBufferSize()
- The default behavior of this method is to return getBufferSize()
on the wrapped response object.
- Specified by:
getBufferSizein interfaceServletResponse
- Returns:
- the actual buffer size used
- See Also:
ServletResponse.setBufferSize(int),ServletResponse.flushBuffer(),ServletResponse.isCommitted(),ServletResponse.reset()
public void
flushBuffer() throws java.io.IOException
此方法的默认行为是对包装的响应对象调用 flushBuffer()。
英文文档:
flushBuffer
public void flushBuffer()
throws IOException
- The default behavior of this method is to call flushBuffer()
on the wrapped response object.
- Specified by:
flushBufferin interfaceServletResponse
public boolean
isCommitted()
此方法的默认行为是返回对包装的响应对象调用 isCommitted() 的结果。
英文文档:
isCommitted
public boolean isCommitted()
- The default behavior of this method is to return isCommitted()
on the wrapped response object.
- Specified by:
isCommittedin interfaceServletResponse
- Returns:
- a boolean indicating if the response has been committed
- See Also:
ServletResponse.setBufferSize(int),ServletResponse.getBufferSize(),ServletResponse.flushBuffer(),ServletResponse.reset()
public void
reset()
此方法的默认行为是对包装的响应对象调用 reset()。
英文文档:
reset
public void reset()
- The default behavior of this method is to call reset()
on the wrapped response object.
- Specified by:
resetin interfaceServletResponse
public void
resetBuffer()
此方法的默认行为是对包装的响应对象调用 resetBuffer()。
英文文档:
resetBuffer
public void resetBuffer()
- The default behavior of this method is to call resetBuffer()
on the wrapped response object.
- Specified by:
resetBufferin interfaceServletResponse
public void
setLocale(java.util.Locale loc)
此方法的默认行为是对包装的响应对象调用 setLocale(Locale loc)。
英文文档:
setLocale
public void setLocale(Locale loc)
- The default behavior of this method is to call setLocale(Locale loc)
on the wrapped response object.
- Specified by:
setLocalein interfaceServletResponse
- Parameters:
loc- the locale of the response- See Also:
ServletResponse.getLocale(),ServletResponse.setContentType(java.lang.String),ServletResponse.setCharacterEncoding(java.lang.String)
public java.util.Locale
getLocale()
此方法的默认行为是返回对包装的响应对象调用 getLocale() 的结果。
英文文档:
getLocale
public Locale getLocale()
- The default behavior of this method is to return getLocale()
on the wrapped response object.
- Specified by:
getLocalein interfaceServletResponse
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Submit a bug or feature
Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!
javax.servlet.ServletResponseWrapper