tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu...@apache.org
Subject cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime ServletResponseWrapperInclude.java JspRuntimeLibrary.java
Date Fri, 11 Jul 2003 01:27:46 GMT
luehe       2003/07/10 18:27:46

  Modified:    jasper2/src/share/org/apache/jasper/runtime
                        ServletResponseWrapperInclude.java
                        JspRuntimeLibrary.java
  Log:
  Partial fix for Bugzilla 21440 ("<jsp:include> whose target performs a 'forward' does
not behave as expected")
  
  Revision  Changes    Path
  1.3       +32 -24    jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/ServletResponseWrapperInclude.java
  
  Index: ServletResponseWrapperInclude.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/ServletResponseWrapperInclude.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServletResponseWrapperInclude.java	27 Aug 2002 22:24:42 -0000	1.2
  +++ ServletResponseWrapperInclude.java	11 Jul 2003 01:27:46 -0000	1.3
  @@ -64,49 +64,57 @@
   import java.lang.IllegalStateException;
   import java.io.Writer;
   import java.io.PrintWriter;
  +import java.io.IOException;
   
   import javax.servlet.*;
   import javax.servlet.http.*;
  -import javax.servlet.jsp.*;
  +import javax.servlet.jsp.JspWriter;
   
   /**
  - * ServletResponseWrapper used for the JSP 'include' action.
  + * ServletResponseWrapper used by the JSP 'include' action.
    *
  - * This 'wrapped' response object is passed as the second argument 
  - * to the internal RequestDispatcher.include(). It channels
  - * all output text into the current Writer.
  + * 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
    */
   
  -public class ServletResponseWrapperInclude
  -    extends HttpServletResponseWrapper
  -{
  +public class ServletResponseWrapperInclude extends HttpServletResponseWrapper {
  +
       /**
  -     * The PrintWriter writes all output to the Writer of the 
  -     * including page.
  +     * PrintWriter which appends to the JspWriter of the including page.
        */
  -    PrintWriter printWriter;
  +    private PrintWriter printWriter;
  +
  +    private JspWriter jspWriter;
   
       public ServletResponseWrapperInclude(ServletResponse response, 
  -					 Writer writer) 
  -    {
  +					 JspWriter jspWriter) {
   	super((HttpServletResponse)response);
  -	this.printWriter = new PrintWriter(writer);
  +	this.printWriter = new PrintWriter(jspWriter);
  +	this.jspWriter = jspWriter;
       }
   
       /**
  -     * Returns a wrapper around the Writer of the including page.
  +     * Returns a wrapper around the JspWriter of the including page.
        */
  -    public java.io.PrintWriter getWriter()
  -	throws java.io.IOException 
  -    {
  +    public PrintWriter getWriter() throws IOException {
   	return printWriter;
       }
   
  -    public ServletOutputStream getOutputStream()
  -	throws java.io.IOException
  -    {
  +    public ServletOutputStream getOutputStream() throws IOException {
   	throw new IllegalStateException();
  +    }
  +
  +    /**
  +     * Clears the output buffer of the JspWriter associated with the including
  +     * page.
  +     */
  +    public void resetBuffer() {
  +	try {
  +	    jspWriter.clearBuffer();
  +	} catch (IOException ioe) {
  +	}
       }
   }
  
  
  
  1.23      +4 -4      jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspRuntimeLibrary.java
  
  Index: JspRuntimeLibrary.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspRuntimeLibrary.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- JspRuntimeLibrary.java	13 May 2003 19:36:37 -0000	1.22
  +++ JspRuntimeLibrary.java	11 Jul 2003 01:27:46 -0000	1.23
  @@ -984,7 +984,7 @@
       public static void include(ServletRequest request,
                                  ServletResponse response,
                                  String relativePath,
  -                               Writer out,
  +                               JspWriter out,
                                  boolean flush)
           throws IOException, ServletException {
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message