craigmcc 01/07/11 19:41:02 Modified: tester/src/bin tester.xml tester/web/WEB-INF web.xml Added: tester/src/tester/org/apache/tester Include06a.java Include07.java Include07a.java Include07b.java Include07c.java tester/web Include06.jsp Include06b.jsp tester/web/golden Include06.txt Include07.txt Log: Add unit tests for a more thorough investigation of Bugzilla #2294. The ultimate problem was actually caused by the use of the invoker servlet on the first include (which does a RequestDispatcher.forward() the first time a particular servlet is invoked). As a result, the "/tester/Include06.jsp" test will currently fail the first time you run it after starting Tomcat, but succeed after that. The underlying cause is under investigation. Revision Changes Path 1.56 +10 -0 jakarta-tomcat-4.0/tester/src/bin/tester.xml Index: tester.xml =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/tester/src/bin/tester.xml,v retrieving revision 1.55 retrieving revision 1.56 diff -u -r1.55 -r1.56 --- tester.xml 2001/07/11 21:18:20 1.55 +++ tester.xml 2001/07/12 02:40:52 1.56 @@ -713,6 +713,16 @@ request="${context.path}/Include05.jsp" outContent="Include05b PASSED" debug="${debug}"/> + <!-- ========== Include Then Include ================================== --> + + <tester host="${host}" port="${port}" protocol="${protocol}" + request="${context.path}/Include06.jsp" debug="${debug}" + golden="${golden.path}/Include06.txt"/> + + <tester host="${host}" port="${port}" protocol="${protocol}" + request="${context.path}/Include07" debug="${debug}" + golden="${golden.path}/Include07.txt"/> + </target> 1.1 jakarta-tomcat-4.0/tester/src/tester/org/apache/tester/Include06a.java Index: Include06a.java =================================================================== /* ========================================================================= * * * * The Apache Software License, Version 1.1 * * * * Copyright (c) 1999, 2000, 2001 The Apache Software Foundation. * * All rights reserved. * * * * ========================================================================= * * * * Redistribution and use in source and binary forms, with or without modi- * * fication, are permitted provided that the following conditions are met: * * * * 1. Redistributions of source code must retain the above copyright notice * * notice, this list of conditions and the following disclaimer. * * * * 2. Redistributions in binary form must reproduce the above copyright * * notice, this list of conditions and the following disclaimer in the * * documentation and/or other materials provided with the distribution. * * * * 3. The end-user documentation included with the redistribution, if any, * * must include the following acknowlegement: * * * * "This product includes software developed by the Apache Software * * Foundation <http://www.apache.org/>." * * * * Alternately, this acknowlegement may appear in the software itself, if * * and wherever such third-party acknowlegements normally appear. * * * * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software * * Foundation" must not be used to endorse or promote products derived * * from this software without prior written permission. For written * * permission, please contact <[EMAIL PROTECTED]>. * * * * 5. Products derived from this software may not be called "Apache" nor may * * "Apache" appear in their names without prior written permission of the * * Apache Software Foundation. * * * * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES * * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * * THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY * * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * * POSSIBILITY OF SUCH DAMAGE. * * * * ========================================================================= * * * * This software consists of voluntary contributions made by many indivi- * * duals on behalf of the Apache Software Foundation. For more information * * on the Apache Software Foundation, please see <http://www.apache.org/>. * * * * ========================================================================= */ package org.apache.tester; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; /** * First subservlet for "include then include" test. * * @author Craig R. McClanahan * @version $Revision: 1.1 $ $Date: 2001/07/12 02:40:55 $ */ public class Include06a extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { PrintWriter writer = response.getWriter(); writer.println("Include06a output"); } } 1.1 jakarta-tomcat-4.0/tester/src/tester/org/apache/tester/Include07.java Index: Include07.java =================================================================== /* ========================================================================= * * * * The Apache Software License, Version 1.1 * * * * Copyright (c) 1999, 2000, 2001 The Apache Software Foundation. * * All rights reserved. * * * * ========================================================================= * * * * Redistribution and use in source and binary forms, with or without modi- * * fication, are permitted provided that the following conditions are met: * * * * 1. Redistributions of source code must retain the above copyright notice * * notice, this list of conditions and the following disclaimer. * * * * 2. Redistributions in binary form must reproduce the above copyright * * notice, this list of conditions and the following disclaimer in the * * documentation and/or other materials provided with the distribution. * * * * 3. The end-user documentation included with the redistribution, if any, * * must include the following acknowlegement: * * * * "This product includes software developed by the Apache Software * * Foundation <http://www.apache.org/>." * * * * Alternately, this acknowlegement may appear in the software itself, if * * and wherever such third-party acknowlegements normally appear. * * * * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software * * Foundation" must not be used to endorse or promote products derived * * from this software without prior written permission. For written * * permission, please contact <[EMAIL PROTECTED]>. * * * * 5. Products derived from this software may not be called "Apache" nor may * * "Apache" appear in their names without prior written permission of the * * Apache Software Foundation. * * * * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES * * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * * THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY * * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * * POSSIBILITY OF SUCH DAMAGE. * * * * ========================================================================= * * * * This software consists of voluntary contributions made by many indivi- * * duals on behalf of the Apache Software Foundation. For more information * * on the Apache Software Foundation, please see <http://www.apache.org/>. * * * * ========================================================================= */ package org.apache.tester; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; /** * Test that insures we can include a servlet that does a forward, then * includes another servlet, and we see all of the output in the right order. * * @author Craig R. McClanahan * @version $Revision: 1.1 $ $Date: 2001/07/12 02:40:55 $ */ public class Include07 extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { // Prepare this response response.setBufferSize(8192); response.setContentType("text/plain"); PrintWriter writer = response.getWriter(); writer.println("Output from Include07"); // Include our first subservlet RequestDispatcher rd1 = getServletContext().getRequestDispatcher("/Include07a"); if (rd1 == null) { writer.println("No RD for '/Include07a'"); } else { rd1.include(request, response); } // Include our second subservlet RequestDispatcher rd2 = getServletContext().getRequestDispatcher("/Include07c"); if (rd2 == null) { writer.println("No RD for '/Include07c'"); } else { rd2.include(request, response); } // Finish this response writer.println("Output from Include07"); while (true) { String message = StaticLogger.read(); if (message == null) break; writer.println(message); } StaticLogger.reset(); } } 1.1 jakarta-tomcat-4.0/tester/src/tester/org/apache/tester/Include07a.java Index: Include07a.java =================================================================== /* ========================================================================= * * * * The Apache Software License, Version 1.1 * * * * Copyright (c) 1999, 2000, 2001 The Apache Software Foundation. * * All rights reserved. * * * * ========================================================================= * * * * Redistribution and use in source and binary forms, with or without modi- * * fication, are permitted provided that the following conditions are met: * * * * 1. Redistributions of source code must retain the above copyright notice * * notice, this list of conditions and the following disclaimer. * * * * 2. Redistributions in binary form must reproduce the above copyright * * notice, this list of conditions and the following disclaimer in the * * documentation and/or other materials provided with the distribution. * * * * 3. The end-user documentation included with the redistribution, if any, * * must include the following acknowlegement: * * * * "This product includes software developed by the Apache Software * * Foundation <http://www.apache.org/>." * * * * Alternately, this acknowlegement may appear in the software itself, if * * and wherever such third-party acknowlegements normally appear. * * * * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software * * Foundation" must not be used to endorse or promote products derived * * from this software without prior written permission. For written * * permission, please contact <[EMAIL PROTECTED]>. * * * * 5. Products derived from this software may not be called "Apache" nor may * * "Apache" appear in their names without prior written permission of the * * Apache Software Foundation. * * * * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES * * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * * THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY * * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * * POSSIBILITY OF SUCH DAMAGE. * * * * ========================================================================= * * * * This software consists of voluntary contributions made by many indivi- * * duals on behalf of the Apache Software Foundation. For more information * * on the Apache Software Foundation, please see <http://www.apache.org/>. * * * * ========================================================================= */ package org.apache.tester; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; /** * Test that insures we can include a servlet that does a forward, then * includes another servlet, and we see all of the output in the right order. * * @author Craig R. McClanahan * @version $Revision: 1.1 $ $Date: 2001/07/12 02:40:56 $ */ public class Include07a extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { // Prepare this response PrintWriter writer = response.getWriter(); // Forward to our subsubservlet RequestDispatcher rd = getServletContext().getRequestDispatcher("/Include07b"); if (rd == null) { writer.println("No RD for '/Include07b'"); } else { rd.include(request, response); } } } 1.1 jakarta-tomcat-4.0/tester/src/tester/org/apache/tester/Include07b.java Index: Include07b.java =================================================================== /* ========================================================================= * * * * The Apache Software License, Version 1.1 * * * * Copyright (c) 1999, 2000, 2001 The Apache Software Foundation. * * All rights reserved. * * * * ========================================================================= * * * * Redistribution and use in source and binary forms, with or without modi- * * fication, are permitted provided that the following conditions are met: * * * * 1. Redistributions of source code must retain the above copyright notice * * notice, this list of conditions and the following disclaimer. * * * * 2. Redistributions in binary form must reproduce the above copyright * * notice, this list of conditions and the following disclaimer in the * * documentation and/or other materials provided with the distribution. * * * * 3. The end-user documentation included with the redistribution, if any, * * must include the following acknowlegement: * * * * "This product includes software developed by the Apache Software * * Foundation <http://www.apache.org/>." * * * * Alternately, this acknowlegement may appear in the software itself, if * * and wherever such third-party acknowlegements normally appear. * * * * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software * * Foundation" must not be used to endorse or promote products derived * * from this software without prior written permission. For written * * permission, please contact <[EMAIL PROTECTED]>. * * * * 5. Products derived from this software may not be called "Apache" nor may * * "Apache" appear in their names without prior written permission of the * * Apache Software Foundation. * * * * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES * * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * * THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY * * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * * POSSIBILITY OF SUCH DAMAGE. * * * * ========================================================================= * * * * This software consists of voluntary contributions made by many indivi- * * duals on behalf of the Apache Software Foundation. For more information * * on the Apache Software Foundation, please see <http://www.apache.org/>. * * * * ========================================================================= */ package org.apache.tester; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; /** * Test that insures we can include a servlet that does a forward, then * includes another servlet, and we see all of the output in the right order. * * @author Craig R. McClanahan * @version $Revision: 1.1 $ $Date: 2001/07/12 02:40:56 $ */ public class Include07b extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { // Prepare this response PrintWriter writer = response.getWriter(); writer.println("Output from Include07b"); } } 1.1 jakarta-tomcat-4.0/tester/src/tester/org/apache/tester/Include07c.java Index: Include07c.java =================================================================== /* ========================================================================= * * * * The Apache Software License, Version 1.1 * * * * Copyright (c) 1999, 2000, 2001 The Apache Software Foundation. * * All rights reserved. * * * * ========================================================================= * * * * Redistribution and use in source and binary forms, with or without modi- * * fication, are permitted provided that the following conditions are met: * * * * 1. Redistributions of source code must retain the above copyright notice * * notice, this list of conditions and the following disclaimer. * * * * 2. Redistributions in binary form must reproduce the above copyright * * notice, this list of conditions and the following disclaimer in the * * documentation and/or other materials provided with the distribution. * * * * 3. The end-user documentation included with the redistribution, if any, * * must include the following acknowlegement: * * * * "This product includes software developed by the Apache Software * * Foundation <http://www.apache.org/>." * * * * Alternately, this acknowlegement may appear in the software itself, if * * and wherever such third-party acknowlegements normally appear. * * * * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software * * Foundation" must not be used to endorse or promote products derived * * from this software without prior written permission. For written * * permission, please contact <[EMAIL PROTECTED]>. * * * * 5. Products derived from this software may not be called "Apache" nor may * * "Apache" appear in their names without prior written permission of the * * Apache Software Foundation. * * * * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES * * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * * THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY * * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * * POSSIBILITY OF SUCH DAMAGE. * * * * ========================================================================= * * * * This software consists of voluntary contributions made by many indivi- * * duals on behalf of the Apache Software Foundation. For more information * * on the Apache Software Foundation, please see <http://www.apache.org/>. * * * * ========================================================================= */ package org.apache.tester; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; /** * Test that insures we can include a servlet that does a forward, then * includes another servlet, and we see all of the output in the right order. * * @author Craig R. McClanahan * @version $Revision: 1.1 $ $Date: 2001/07/12 02:40:56 $ */ public class Include07c extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { // Prepare this response PrintWriter writer = response.getWriter(); writer.println("Output from Include07c"); } } 1.1 jakarta-tomcat-4.0/tester/web/Include06.jsp Index: Include06.jsp =================================================================== <%@ page contentType="text/plain" %>========== <jsp:include page="servlet/org.apache.tester.Include06a" flush="false"/>========== <jsp:include page="/Include06b.jsp"/>========== 1.1 jakarta-tomcat-4.0/tester/web/Include06b.jsp Index: Include06b.jsp =================================================================== Include06b.jsp output 1.42 +50 -0 jakarta-tomcat-4.0/tester/web/WEB-INF/web.xml Index: web.xml =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/tester/web/WEB-INF/web.xml,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- web.xml 2001/07/11 21:18:29 1.41 +++ web.xml 2001/07/12 02:40:59 1.42 @@ -673,6 +673,31 @@ </servlet> <servlet> + <servlet-name>Include06a</servlet-name> + <servlet-class>org.apache.tester.Include06a</servlet-class> + </servlet> + + <servlet> + <servlet-name>Include07</servlet-name> + <servlet-class>org.apache.tester.Include07</servlet-class> + </servlet> + + <servlet> + <servlet-name>Include07a</servlet-name> + <servlet-class>org.apache.tester.Include07a</servlet-class> + </servlet> + + <servlet> + <servlet-name>Include07b</servlet-name> + <servlet-class>org.apache.tester.Include07b</servlet-class> + </servlet> + + <servlet> + <servlet-name>Include07c</servlet-name> + <servlet-class>org.apache.tester.Include07c</servlet-class> + </servlet> + + <servlet> <servlet-name>Jndi01</servlet-name> <servlet-class>org.apache.tester.Jndi01</servlet-class> <load-on-startup>1</load-on-startup> @@ -1204,6 +1229,31 @@ <servlet-mapping> <servlet-name>Include04b</servlet-name> <url-pattern>/Include04b</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>Include06a</servlet-name> + <url-pattern>/Include06a</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>Include07</servlet-name> + <url-pattern>/Include07</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>Include07a</servlet-name> + <url-pattern>/Include07a</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>Include07b</servlet-name> + <url-pattern>/Include07b</url-pattern> + </servlet-mapping> + + <servlet-mapping> + <servlet-name>Include07c</servlet-name> + <url-pattern>/Include07c</url-pattern> </servlet-mapping> <servlet-mapping> 1.1 jakarta-tomcat-4.0/tester/web/golden/Include06.txt Index: Include06.txt =================================================================== ========== Include06a output ========== Include06b.jsp output ========== 1.1 jakarta-tomcat-4.0/tester/web/golden/Include07.txt Index: Include07.txt =================================================================== Output from Include07 Output from Include07b Output from Include07c Output from Include07