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 isParams.jsp params.jsp paramsIS.jsp
Date Tue, 06 Feb 2001 06:53:33 GMT
costin      01/02/05 22:53:33

  Added:       src/tests/webpages/WEB-INF/classes/params
                        InputStreamParams.java Params.java
                        ParamsInputStream.java
               src/tests/webpages/params isParams.jsp params.jsp
                        paramsIS.jsp
  Log:
  Starting to add test cases for params.
  More to come - we need to test RD + params ( ordering, multiple levels,
  etc ), what happen with the body ( it is processed only on getParameter ),
  both for jsp and servlets.
  
  Also, what happens with invalid query strings, what happens with
  POST with query string ( query should take precedence ).
  
  The encoding tests will be added later, when the encoding issues will be
  treated.
  
  Revision  Changes    Path
  1.1                  jakarta-tomcat/src/tests/webpages/WEB-INF/classes/params/InputStreamParams.java
  
  Index: InputStreamParams.java
  ===================================================================
  package request;
  
  import java.io.*;
  import java.text.*;
  import java.util.*;
  import javax.servlet.*;
  import javax.servlet.http.*;
  
  /**
   *
   */
  public class InputStreamParams extends HttpServlet {
  
      public void service(HttpServletRequest request,
  			HttpServletResponse response)
          throws IOException, ServletException
      {
          response.setContentType("text/plain");
          PrintWriter out = response.getWriter();
  
  	InputStream in=request.getInputStream();
  
  	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());
      }
  
  }
  
  
  
  
  
  
  1.1                  jakarta-tomcat/src/tests/webpages/WEB-INF/classes/params/Params.java
  
  Index: Params.java
  ===================================================================
  package request;
  
  import java.io.*;
  import java.text.*;
  import java.util.*;
  import javax.servlet.*;
  import javax.servlet.http.*;
  
  /**
   *
   */
  public class Params extends HttpServlet {
  
      public void service(HttpServletRequest request,
  			HttpServletResponse response)
          throws IOException, ServletException
      {
          response.setContentType("text/plain");
          PrintWriter out = response.getWriter();
  
  	out.println("Request parameters: " );
  	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());
      }
  
  }
  
  
  
  
  
  
  1.1                  jakarta-tomcat/src/tests/webpages/WEB-INF/classes/params/ParamsInputStream.java
  
  Index: ParamsInputStream.java
  ===================================================================
  package request;
  
  import java.io.*;
  import java.text.*;
  import java.util.*;
  import javax.servlet.*;
  import javax.servlet.http.*;
  
  /**
   *
   */
  public class ParamsInputStream extends HttpServlet {
  
      public void service(HttpServletRequest request,
  			HttpServletResponse response)
          throws IOException, ServletException
      {
  	PrintWriter out = response.getWriter();
          response.setContentType("text/plain");
  	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("QueryString= " + request.getQueryString());
  
  
  	InputStream in=request.getInputStream();
  
  	out.println("START BODY: " );
  	int c;
  	while( (c=in.read()) >= 0 ) {
  	    out.write( (char)c );
  	}
  	out.println();
  	out.println("END BODY");
  
      }
  
  }
  
  
  
  
  
  
  1.1                  jakarta-tomcat/src/tests/webpages/params/isParams.jsp
  
  Index: isParams.jsp
  ===================================================================
  <% 
          response.setContentType("text/plain");
          PrintWriter out = response.getWriter();
  
  	InputStream in=request.getInputStream();
  
  	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());
  %>
  
  
  1.1                  jakarta-tomcat/src/tests/webpages/params/params.jsp
  
  Index: params.jsp
  ===================================================================
  <% 
          response.setContentType("text/plain");
          PrintWriter out = response.getWriter();
  
  	out.println("Request parameters: " );
  	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());
  %>
  
  
  1.1                  jakarta-tomcat/src/tests/webpages/params/paramsIS.jsp
  
  Index: paramsIS.jsp
  ===================================================================
  <% 
  	PrintWriter out = response.getWriter();
          response.setContentType("text/plain");
  	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("QueryString= " + request.getQueryString());
  
  
  	InputStream in=request.getInputStream();
  
  	out.println("START BODY: " );
  	int c;
  	while( (c=in.read()) >= 0 ) {
  	    out.write( (char)c );
  	}
  	out.println();
  	out.println("END BODY");
  
  %>
  
  

Mime
View raw message