FileDocCategorySizeDatePackage
BufferedHttpResponseWrapper.javaAPI DocExample2286Sun Sep 02 14:59:04 BST 2001com.oreilly.javaxslt.util

BufferedHttpResponseWrapper

public class BufferedHttpResponseWrapper extends HttpServletResponseWrapper
A custom response wrapper that captures all output in a buffer.

Fields Summary
private BufferedServletOutputStream
bufferedServletOut
private PrintWriter
printWriter
private ServletOutputStream
outputStream
Constructors Summary
public BufferedHttpResponseWrapper(HttpServletResponse origResponse)


       
        super(origResponse);
    
Methods Summary
public voidflushBuffer()

        if (this.outputStream != null) {
            this.outputStream.flush();
        } else if (this.printWriter != null) {
            this.printWriter.flush();
        }
    
public byte[]getBuffer()

        return this.bufferedServletOut.getBuffer();
    
public intgetBufferSize()

        return this.bufferedServletOut.getBuffer().length;
    
public javax.servlet.ServletOutputStreamgetOutputStream()

        if (this.printWriter != null) {
            throw new IllegalStateException(
                "The Servlet API forbids calling getOutputStream() after"
                + " getWriter() has been called");
        }

        if (this.outputStream == null) {
            this.outputStream = this.bufferedServletOut;
        }
        return this.outputStream;
    
public java.io.PrintWritergetWriter()

        if (this.outputStream != null) {
            throw new IllegalStateException(
                    "The Servlet API forbids calling getWriter() after"
                    + " getOutputStream() has been called");
        }

        if (this.printWriter == null) {
            this.printWriter = new PrintWriter(this.bufferedServletOut);
        }
        return this.printWriter;
    
public voidreset()

        this.bufferedServletOut.reset();
    
public voidresetBuffer()

        this.bufferedServletOut.reset();
    
public voidsetBufferSize(int size)

        this.bufferedServletOut.setBufferSize(size);