FileDocCategorySizeDatePackage
ServletResponseWrapperInclude.javaAPI DocGlassfish v2 API5262Fri May 04 22:32:54 BST 2007org.apache.jasper.runtime

ServletResponseWrapperInclude

public class ServletResponseWrapperInclude extends HttpServletResponseWrapper
ServletResponseWrapper used by the JSP 'include' action. This wrapper response object is passed to RequestDispatcher.include(), so that the output of the included resource is appended to that of the including page.
author
Pierre Delisle

Fields Summary
private PrintWriter
printWriter
PrintWriter which appends to the JspWriter of the including page.
private javax.servlet.jsp.JspWriter
jspWriter
private boolean
canFlushWriter
Indicates whether or not the wrapped JspWriter can be flushed.
Constructors Summary
public ServletResponseWrapperInclude(ServletResponse response, javax.servlet.jsp.JspWriter jspWriter)

	super((HttpServletResponse)response);

        this.jspWriter = jspWriter;
        if (jspWriter instanceof JspWriterImpl &&
                ((JspWriterImpl)jspWriter).shouldOutputBytes()) {
            this.printWriter = new PrintWriterWrapper((JspWriterImpl)jspWriter);
        } else {
            this.printWriter = new PrintWriter(jspWriter);
        }
            
        // START CR 6466049
        this.canFlushWriter = (jspWriter instanceof JspWriterImpl);
        // END CR 6466049
    
Methods Summary
public booleancanFlush()
Indicates whether or not the wrapped JspWriter can be flushed. (BodyContent objects cannot be flushed)

        return canFlushWriter;
    
public voidflushBuffer()
Flush the wrapper around the JspWriter of the including page.

        printWriter.flush();
    
public javax.servlet.ServletOutputStreamgetOutputStream()

	throw new IllegalStateException();
    
public java.io.PrintWritergetWriter()
Returns a wrapper around the JspWriter of the including page.

	return printWriter;
    
public booleanhasData()
Are there any data to be flushed ?

        if (!canFlushWriter || ((JspWriterImpl)jspWriter).hasData()) {
            return true;
        }

        return false;
    
public voidresetBuffer()
Clears the output buffer of the JspWriter associated with the including page.

	try {
	    jspWriter.clearBuffer();
	} catch (IOException ioe) {
	}