java.lang.Object | +--javax.servlet.ServletResponseWrapper
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
ServletResponseWrapper(ServletResponse response) Creates a ServletResponse adaptor wrapping the given response object. |
flushBuffer() The default behavior of this method is to call flushBuffer() on the wrapped response object. | |
getBufferSize() The default behavior of this method is to return getBufferSize() on the wrapped response object. | |
getCharacterEncoding() The default behavior of this method is to return getCharacterEncoding() on the wrapped response object. | |
getLocale() The default behavior of this method is to return getLocale() on the wrapped response object. | |
getOutputStream() The default behavior of this method is to return getOutputStream() on the wrapped response object. | |
getResponse() Return the wrapped ServletResponse object. | |
getWriter() The default behavior of this method is to return getWriter() on the wrapped response object. | |
isCommitted() The default behavior of this method is to return isCommitted() on the wrapped response object. | |
reset() The default behavior of this method is to call reset() on the wrapped response object. | |
resetBuffer() The default behavior of this method is to call resetBuffer() on the wrapped response object. | |
setBufferSize(int size) The default behavior of this method is to call setBufferSize(int size) on the wrapped response object. | |
setContentLength(int len) The default behavior of this method is to call setContentLength(int len) on the wrapped response object. | |
setContentType(java.lang.String type) The default behavior of this method is to call setContentType(String type) on the wrapped response object. | |
setLocale(java.util.Locale loc) The default behavior of this method is to call setLocale(Locale loc) on the wrapped response object. | |
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 |
publicServletResponseWrapper(ServletResponse response)
java.lang.IllegalArgumentException
- if the response is null.publicServletResponsegetResponse()
public voidsetResponse(ServletResponse response)
java.lang.IllegalArgumentException
- if the response is null.public java.lang.StringgetCharacterEncoding()
getCharacterEncoding
in interfaceServletResponse
javax.servlet.ServletResponse
String
specifying thename of the charset, forexample,ISO-8859-1
publicServletOutputStreamgetOutputStream() throws java.io.IOException
getOutputStream
in interfaceServletResponse
javax.servlet.ServletResponse
ServletOutputStream
for writing binary datajava.lang.IllegalStateException
- if thegetWriter
method has been called on this responsejava.io.IOException
- if an input or output exception occurredServletResponse.getWriter()
public java.io.PrintWritergetWriter() throws java.io.IOException
getWriter
in interfaceServletResponse
javax.servlet.ServletResponse
PrintWriter
object that can return character data to the clientjava.io.UnsupportedEncodingException
- if the charset specified insetContentType
cannot beusedjava.lang.IllegalStateException
- if thegetOutputStream
method has already been called for this response objectjava.io.IOException
- if an input or output exception occurredServletResponse.getOutputStream()
,ServletResponse.setContentType(java.lang.String)
public voidsetContentLength(int len)
setContentLength
in interfaceServletResponse
javax.servlet.ServletResponse
len
- an integer specifying the length of the content being returned to the client; setsthe Content-Length headerpublic voidsetContentType(java.lang.String type)
setContentType
in interfaceServletResponse
javax.servlet.ServletResponse
type
- aString
specifying the MIME type of the contentServletResponse.getOutputStream()
,ServletResponse.getWriter()
public voidsetBufferSize(int size)
setBufferSize
in interfaceServletResponse
javax.servlet.ServletResponse
size
- the preferred buffer sizejava.lang.IllegalStateException
- if this method is called aftercontent has been writtenServletResponse.getBufferSize()
,ServletResponse.flushBuffer()
,ServletResponse.isCommitted()
,ServletResponse.reset()
public intgetBufferSize()
getBufferSize
in interfaceServletResponse
javax.servlet.ServletResponse
ServletResponse.setBufferSize(int)
,ServletResponse.flushBuffer()
,ServletResponse.isCommitted()
,ServletResponse.reset()
public voidflushBuffer() throws java.io.IOException
flushBuffer
in interfaceServletResponse
javax.servlet.ServletResponse
ServletResponse.setBufferSize(int)
,ServletResponse.getBufferSize()
,ServletResponse.isCommitted()
,ServletResponse.reset()
public booleanisCommitted()
isCommitted
in interfaceServletResponse
javax.servlet.ServletResponse
ServletResponse.setBufferSize(int)
,ServletResponse.getBufferSize()
,ServletResponse.flushBuffer()
,ServletResponse.reset()
public voidreset()
reset
in interfaceServletResponse
javax.servlet.ServletResponse
java.lang.IllegalStateException
- if the response has already been committedServletResponse.setBufferSize(int)
,ServletResponse.getBufferSize()
,ServletResponse.flushBuffer()
,ServletResponse.isCommitted()
public voidresetBuffer()
resetBuffer
in interfaceServletResponse
javax.servlet.ServletResponse
ServletResponse.setBufferSize(int)
,ServletResponse.getBufferSize()
,ServletResponse.isCommitted()
,ServletResponse.reset()
public voidsetLocale(java.util.Locale loc)
setLocale
in interfaceServletResponse
javax.servlet.ServletResponse
loc
- the locale of the responseServletResponse.getLocale()
public java.util.LocalegetLocale()
getLocale
in interfaceServletResponse
javax.servlet.ServletResponse
ServletResponse.setLocale(java.util.Locale)