You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2005/12/07 23:52:31 UTC
svn commit: r354887 -
/tomcat/jasper/branches/tc4.1.x/jasper2/src/share/org/apache/jasper/runtime/ServletResponseWrapperInclude.java
Author: markt
Date: Wed Dec 7 14:52:26 2005
New Revision: 354887
URL: http://svn.apache.org/viewcvs?rev=354887&view=rev
Log:
Commit partial fix for bug 21440 - <jsp:include> when target performs a forward
- This is a port of Jan's patch in 5.5.x
Modified:
tomcat/jasper/branches/tc4.1.x/jasper2/src/share/org/apache/jasper/runtime/ServletResponseWrapperInclude.java
Modified: tomcat/jasper/branches/tc4.1.x/jasper2/src/share/org/apache/jasper/runtime/ServletResponseWrapperInclude.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/branches/tc4.1.x/jasper2/src/share/org/apache/jasper/runtime/ServletResponseWrapperInclude.java?rev=354887&r1=354886&r2=354887&view=diff
==============================================================================
--- tomcat/jasper/branches/tc4.1.x/jasper2/src/share/org/apache/jasper/runtime/ServletResponseWrapperInclude.java (original)
+++ tomcat/jasper/branches/tc4.1.x/jasper2/src/share/org/apache/jasper/runtime/ServletResponseWrapperInclude.java Wed Dec 7 14:52:26 2005
@@ -18,49 +18,58 @@
import java.lang.IllegalStateException;
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 JspWriter.
+ * 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 JspWriter of the
* including page.
*/
- PrintWriter printWriter;
+ private PrintWriter printWriter;
+
+ private JspWriter jspWriter;
public ServletResponseWrapperInclude(ServletResponse response,
- JspWriter jspWriter)
- {
+ JspWriter jspWriter) {
super((HttpServletResponse)response);
this.printWriter = new PrintWriter(jspWriter);
+ this.jspWriter = jspWriter;
}
/**
* Returns a wrapper around the JspWriter of the including page.
*/
- public java.io.PrintWriter getWriter()
- throws java.io.IOException
- {
+ public PrintWriter getWriter() throws java.io.IOException {
return printWriter;
}
- public ServletOutputStream getOutputStream()
- throws java.io.IOException
- {
+ public ServletOutputStream getOutputStream() throws java.io.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) {
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org