Author: markt Date: Thu Jan 16 14:51:06 2014 New Revision: 1558821 URL: http://svn.apache.org/r1558821 Log: Follow-up to r1558814 - include the actual change
Modified: tomcat/tc7.0.x/trunk/ (props changed) tomcat/tc7.0.x/trunk/java/org/apache/jasper/runtime/PageContextImpl.java tomcat/tc7.0.x/trunk/test/org/apache/jasper/runtime/TestPageContextImpl.java Propchange: tomcat/tc7.0.x/trunk/ ------------------------------------------------------------------------------ Merged /tomcat/trunk:r1558811 Modified: tomcat/tc7.0.x/trunk/java/org/apache/jasper/runtime/PageContextImpl.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/jasper/runtime/PageContextImpl.java?rev=1558821&r1=1558820&r2=1558821&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/jasper/runtime/PageContextImpl.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/jasper/runtime/PageContextImpl.java Thu Jan 16 14:51:06 2014 @@ -49,6 +49,7 @@ import javax.servlet.jsp.el.ExpressionEv import javax.servlet.jsp.el.VariableResolver; import javax.servlet.jsp.tagext.BodyContent; +import org.apache.jasper.Constants; import org.apache.jasper.compiler.Localizer; import org.apache.jasper.el.ELContextImpl; import org.apache.jasper.el.ExpressionEvaluatorImpl; @@ -150,6 +151,9 @@ public class PageContextImpl extends Pag // initialize the initial out ... depth = -1; + if (bufferSize == JspWriter.DEFAULT_BUFFER) { + bufferSize = Constants.DEFAULT_BUFFER_SIZE; + } if (this.baseOut == null) { this.baseOut = new JspWriterImpl(response, bufferSize, autoFlush); } else { Modified: tomcat/tc7.0.x/trunk/test/org/apache/jasper/runtime/TestPageContextImpl.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/jasper/runtime/TestPageContextImpl.java?rev=1558821&r1=1558820&r2=1558821&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/jasper/runtime/TestPageContextImpl.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/jasper/runtime/TestPageContextImpl.java Thu Jan 16 14:51:06 2014 @@ -17,15 +17,24 @@ package org.apache.jasper.runtime; import java.io.File; +import java.io.IOException; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import javax.servlet.jsp.JspFactory; +import javax.servlet.jsp.JspWriter; +import javax.servlet.jsp.PageContext; import org.junit.Assert; import org.junit.Test; +import org.apache.catalina.Context; import org.apache.catalina.startup.Tomcat; import org.apache.catalina.startup.TomcatBaseTest; +import org.apache.jasper.Constants; import org.apache.tomcat.util.buf.ByteChunk; public class TestPageContextImpl extends TomcatBaseTest { @@ -50,4 +59,44 @@ public class TestPageContextImpl extends Assert.assertTrue(body.contains("OK")); Assert.assertFalse(body.contains("FAIL")); } + + @Test + public void testDefaultBufferSize() throws Exception { + Tomcat tomcat = getTomcatInstance(); + + File appDir = new File("test/webapp"); + // app dir is relative to server home + Context ctx = tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); + + // Add the Servlet + Tomcat.addServlet(ctx, "bug56010", new Bug56010()); + ctx.addServletMapping("/bug56010", "bug56010"); + + tomcat.start(); + + ByteChunk res = getUrl("http://localhost:" + getPort() + "/test/bug56010"); + + String result = res.toString(); + Assert.assertTrue(result.contains("OK")); + } + + public static class Bug56010 extends HttpServlet { + + private static final long serialVersionUID = 1L; + + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) + throws ServletException, IOException { + + PageContext pageContext = JspFactory.getDefaultFactory().getPageContext( + this, req, resp, null, false, JspWriter.DEFAULT_BUFFER, true); + JspWriter out = pageContext.getOut(); + if (Constants.DEFAULT_BUFFER_SIZE == out.getBufferSize()) { + resp.getWriter().println("OK"); + } else { + resp.getWriter().println("FAIL"); + } + } + + } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org