tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-tomcat/src/tests/webpages/params includeISParams.jsp isParams.jsp
Date Sat, 10 Feb 2001 22:37:32 GMT
costin      01/02/10 14:37:32

  Modified:    src/tests/webpages/WEB-INF test-tomcat.xml
               src/tests/webpages/params isParams.jsp
  Added:       src/tests/webpages/params includeISParams.jsp
  Log:
  Added a JSP test: JSP includes a servlet that calls getInputStream, then
  getParameter(). The input stream should be able to read the body, the
  result of getParameter is not defined ( AFAIK ). Tomcat behavior is to
  return the query parameters ( the body is alredy consumed )
  
  Revision  Changes    Path
  1.20      +22 -1     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.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- test-tomcat.xml	2001/02/10 22:11:32	1.19
  +++ test-tomcat.xml	2001/02/10 22:37:32	1.20
  @@ -16,7 +16,7 @@
           early tests.
       -->
   
  -     <property name="revision" value="$Revision: 1.19 $" />  
  +     <property name="revision" value="$Revision: 1.20 $" />  
        <property name="host" value="127.0.0.1" />
        <property name="port"     value="8080" />
        <property name="outputType"     value="text" />
  @@ -244,6 +244,27 @@
             <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&amp;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>
  +    
  +      <!-- Fails in Tomcat3.2.x -->
  +      <httpClient>
  +          <comment>POST, JSP, include, BODY, params </comment>
  +          <httpRequest 
  +              path="/test/params/includeISParams.jsp" 
                 method="POST">
                <param name="a" value="k" type="GET" />
                <param name="c" value="l" type="GET"/>
  
  
  
  1.2       +11 -27    jakarta-tomcat/src/tests/webpages/params/isParams.jsp
  
  Index: isParams.jsp
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/tests/webpages/params/isParams.jsp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- isParams.jsp	2001/02/06 06:53:32	1.1
  +++ isParams.jsp	2001/02/10 22:37:32	1.2
  @@ -1,32 +1,16 @@
   <% 
           response.setContentType("text/plain");
  -        PrintWriter out = response.getWriter();
  +        PrintWriter outW = response.getWriter();
   
  -	InputStream in=request.getInputStream();
  +	ServletUtil.printBody( request, outW );
  +	outW.flush();
   
  -	out.println("START BODY: " );
  -	int c;
  -	while( (c=in.read()) >= 0 ) {
  -	    out.write( (char)c );
  -	}
  -	out.println();
  -	out.println("END BODY");
  -
  -	// Now get parameters - only query should be available :-)
  -	Enumeration paramN=request.getParameterNames();
  -
  -	while( paramN.hasMoreElements() ) {
  -	    String name=(String)paramN.nextElement();
  -	    String all[]=request.getParameterValues(name);
  -
  -	    out.print(name);
  -	    out.print(" = [ " );
  -	    for( int i=0; i<all.length; i++ ) {
  -		if( i>0 ) out.print( " , ");
  -		out.print( all[i] );
  -	    }
  -	    out.println( " ]");
  -	    
  -	}
  -        out.println(request.getQueryString());
  +	String pi=(String)request.
  +	    getAttribute( "javax.servlet.include.path_info");
  +	if( pi==null ) pi="";
  +	ServletUtil.printParamValues( "", " ]",
  +				      pi + ":", " = [ ",
  +				      "", "",
  +				      " , ",
  +				      request, outW );
   %>
  
  
  
  1.1                  jakarta-tomcat/src/tests/webpages/params/includeISParams.jsp
  
  Index: includeISParams.jsp
  ===================================================================
  <% 
          response.setContentType("text/plain");
          PrintWriter outW = response.getWriter();
  
  	// No parameter is read 
  
  	String uri="/servlet/params.InputStreamParams/include1?a=b";
  	outW.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, outW );
  %>
  
  

Mime
View raw message