Class BufferedServletOutput


  • public final class BufferedServletOutput
    extends Object
    Helper class to be used in ServletResponse wrappers. It allows to buffer the output without committing it to the underlying response. Also it exposes methods to access the buffers for the writer and output stream. When calling close it will automatically spool the buffers to the underlying response.
    • Constructor Detail

      • BufferedServletOutput

        public BufferedServletOutput​(javax.servlet.ServletResponse wrappedResponse)
        Creates a new servlet output buffering both the underlying writer and output stream.
        Parameters:
        wrappedResponse - the wrapped response
      • BufferedServletOutput

        public BufferedServletOutput​(javax.servlet.ServletResponse wrappedResponse,
                                     StringWriter writer,
                                     ByteArrayOutputStream outputStream)
        Creates a new servlet output using the given StringWriter and OutputStream as buffers.
        Parameters:
        wrappedResponse - the wrapped response
        writer - the writer to use as buffer (may be null in case you don't want to buffer the writer)
        outputStream - the ByteArrayOutputStream to use as buffer for getOutputStream() (may be null in case you don't want to buffer the output stream)