You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2001/02/10 23:11:33 UTC
cvs commit: jakarta-tomcat/src/tests/webpages/WEB-INF/classes/params RDIncludeISParams.java InputStreamParams.java
costin 01/02/10 14:11:32
Modified: src/tests/webpages/WEB-INF test-tomcat.xml
src/tests/webpages/WEB-INF/classes/params
InputStreamParams.java
Added: src/tests/webpages/WEB-INF/classes/params
RDIncludeISParams.java
Log:
Added another test for params: The body is read on the first getParam.
This used to fail in Tomcat3.2 ( since getParameters() was called in
RequestDispatcher , trigering the read of the body ), now works fine.
BTW, this test will also fail for JSPs if JspServlet is used ( again,
getParameter is called in JspServlet, forcing a read )
Revision Changes Path
1.19 +24 -2 jakarta-tomcat/src/tests/webpages/WEB-INF/test-tomcat.xml
Index: test-tomcat.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/tests/webpages/WEB-INF/test-tomcat.xml,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- test-tomcat.xml 2001/02/10 21:25:28 1.18
+++ test-tomcat.xml 2001/02/10 22:11:32 1.19
@@ -16,7 +16,7 @@
early tests.
-->
- <property name="revision" value="$Revision: 1.18 $" />
+ <property name="revision" value="$Revision: 1.19 $" />
<property name="host" value="127.0.0.1" />
<property name="port" value="8080" />
<property name="outputType" value="text" />
@@ -218,7 +218,7 @@
<responseMatch match="postInclude2:a = [ k , m ]" />
<responseMatch match="postInclude2:c = [ l ]" />
</httpClient>
-
+
<httpClient>
<comment>RequestDispatcher - POST, include, params </comment>
<httpRequest
@@ -239,6 +239,28 @@
<responseMatch match="postInclude2:c = [ l ]" />
</httpClient>
+ <!-- Fails in Tomcat3.2.x -->
+ <httpClient>
+ <comment>RequestDispatcher - POST, include, BODY, params </comment>
+ <httpRequest
+ path="/test/servlet/params.RDIncludeISParams"
+ method="POST">
+ <param name="a" value="k" type="GET" />
+ <param name="c" value="l" type="GET"/>
+ <param name="a" value="m" type="POST"/>
+ <param name="b" value="n" type="POST"/>
+ </httpRequest>
+ <!-- BODY - read with IS, inside the included servlet -->
+ <responseMatch match="a=m&b=n" />
+
+ <responseMatch match="/include1:c = [ l ]" />
+ <responseMatch match="/include1:a = [ b , k ]" />
+ <responseMatch match="/include1:b = [ n ]" magnitude="false" />
+ <responseMatch match="postInclude1:a = [ k ]" />
+ <responseMatch match="postInclude1:c = [ l ]" />
+ </httpClient>
+
+
</target>
1.3 +8 -1 jakarta-tomcat/src/tests/webpages/WEB-INF/classes/params/InputStreamParams.java
Index: InputStreamParams.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/tests/webpages/WEB-INF/classes/params/InputStreamParams.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- InputStreamParams.java 2001/02/07 06:49:33 1.2
+++ InputStreamParams.java 2001/02/10 22:11:32 1.3
@@ -21,7 +21,14 @@
ServletUtil.printBody( request, out );
out.flush();
- ServletUtil.printParams( request, out );
+ String pi=(String)request.
+ getAttribute( "javax.servlet.include.path_info");
+ if( pi==null ) pi="";
+ ServletUtil.printParamValues( "", " ]",
+ pi + ":", " = [ ",
+ "", "",
+ " , ",
+ request, out );
}
}
1.1 jakarta-tomcat/src/tests/webpages/WEB-INF/classes/params/RDIncludeISParams.java
Index: RDIncludeISParams.java
===================================================================
package params;
import java.io.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
/**
*
*/
public class RDIncludeISParams extends HttpServlet {
public void service(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
response.setContentType("text/plain");
PrintWriter out = response.getWriter();
// No parameter is read
String uri="params.InputStreamParams/include1?a=b";
out.println("Calling RD.include for: " + uri);
// The POST body should be available in the included
// servlet - it should not be read before the first
// getParameter.
RequestDispatcher rd=request.getRequestDispatcher(uri);
rd.include( request, response );
ServletUtil.printParamValues( "", " ]",
"postInclude1:", " = [ ",
"", "",
" , ",
request, out );
}
}