Package org.zkoss.web.servlet
Class BufferedResponse
- java.lang.Object
-
- javax.servlet.ServletResponseWrapper
-
- org.zkoss.web.servlet.BufferedResponse
-
- All Implemented Interfaces:
javax.servlet.ServletResponse
public class BufferedResponse extends javax.servlet.ServletResponseWrapper
A servlet response that uses another writer or stream as the output.- Author:
- tomyeh
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
flushBuffer()
static javax.servlet.ServletResponse
getInstance(javax.servlet.ServletResponse response, java.io.OutputStream stream)
Returns a buffered response with a output stream, if stream is not null; or the original response if stream is null.static javax.servlet.ServletResponse
getInstance(javax.servlet.ServletResponse response, java.io.Writer writer)
Returns a buffered response with a writer, if writer is not null; or the original response if writer is null.javax.servlet.ServletOutputStream
getOutputStream()
java.io.PrintWriter
getWriter()
void
resetBuffer()
Useful only if StringWriter or ByteArrayOutputStream is used to construct this object.-
Methods inherited from class javax.servlet.ServletResponseWrapper
getBufferSize, getCharacterEncoding, getContentType, getLocale, getResponse, isCommitted, isWrapperFor, isWrapperFor, reset, setBufferSize, setCharacterEncoding, setContentLength, setContentLengthLong, setContentType, setLocale, setResponse
-
-
-
-
Method Detail
-
getInstance
public static final javax.servlet.ServletResponse getInstance(javax.servlet.ServletResponse response, java.io.Writer writer)
Returns a buffered response with a writer, if writer is not null; or the original response if writer is null. If response is HttpServletResponse,HttpBufferedResponse.getInstance(javax.servlet.http.HttpServletResponse, java.io.Writer)
is returned. It is smart enough not to wrap the same writer twice.
-
getInstance
public static final javax.servlet.ServletResponse getInstance(javax.servlet.ServletResponse response, java.io.OutputStream stream)
Returns a buffered response with a output stream, if stream is not null; or the original response if stream is null. If response is HttpServletResponse,HttpBufferedResponse.getInstance(javax.servlet.http.HttpServletResponse, java.io.Writer)
is returned. It is smart enough not to wrap the same stream twice.
-
getWriter
public java.io.PrintWriter getWriter() throws java.io.IOException
- Specified by:
getWriter
in interfacejavax.servlet.ServletResponse
- Overrides:
getWriter
in classjavax.servlet.ServletResponseWrapper
- Throws:
java.io.IOException
-
getOutputStream
public javax.servlet.ServletOutputStream getOutputStream() throws java.io.IOException
- Specified by:
getOutputStream
in interfacejavax.servlet.ServletResponse
- Overrides:
getOutputStream
in classjavax.servlet.ServletResponseWrapper
- Throws:
java.io.IOException
-
flushBuffer
public void flushBuffer() throws java.io.IOException
- Specified by:
flushBuffer
in interfacejavax.servlet.ServletResponse
- Overrides:
flushBuffer
in classjavax.servlet.ServletResponseWrapper
- Throws:
java.io.IOException
-
resetBuffer
public void resetBuffer()
Useful only if StringWriter or ByteArrayOutputStream is used to construct this object.- Specified by:
resetBuffer
in interfacejavax.servlet.ServletResponse
- Overrides:
resetBuffer
in classjavax.servlet.ServletResponseWrapper
-
-