tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@hyperreal.org
Subject cvs commit: jakarta-tomcat/src/tests/webpages/WEB-INF/classes ServletParam.java
Date Thu, 04 Nov 1999 00:13:12 GMT
costin      99/11/03 16:13:08

  Modified:    src/tests/webpages/WEB-INF web.xml
  Added:       src/tests/webpages/WEB-INF/classes ServletParam.java
  Log:
  Server side of "multiple names for a servlet" test.
  
  Revision  Changes    Path
  1.2       +51 -0     jakarta-tomcat/src/tests/webpages/WEB-INF/web.xml
  
  Index: web.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/tests/webpages/WEB-INF/web.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- web.xml	1999/10/09 00:20:58	1.1
  +++ web.xml	1999/11/04 00:12:57	1.2
  @@ -69,4 +69,55 @@
               *.bop
           </url-pattern>
       </servlet-mapping>
  +    
  +    <servlet>
  +        <servlet-name>
  +            servletParam1
  +        </servlet-name>
  +        <servlet-class>
  +            ServletParam
  +        </servlet-class>
  +        <init-param>
  +            <param-name>
  +                param1
  +            </param-name>
  +            <param-value>
  +                value1
  +            </param-value>
  +        </init-param>
  +        <init-param>
  +            <param-name>
  +                param2
  +            </param-name>
  +            <param-value>
  +                value2
  +            </param-value>
  +        </init-param>
  +    </servlet>          
  +
  +    <servlet>
  +        <servlet-name>
  +            servletParam2
  +        </servlet-name>
  +        <servlet-class>
  +            ServletParam
  +        </servlet-class>
  +        <init-param>
  +            <param-name>
  +                param3
  +            </param-name>
  +            <param-value>
  +                value3
  +            </param-value>
  +        </init-param>
  +        <init-param>
  +            <param-name>
  +                param4
  +            </param-name>
  +            <param-value>
  +                value4
  +            </param-value>
  +        </init-param>
  +    </servlet>          
  +
   </web-app>
  
  
  
  1.1                  jakarta-tomcat/src/tests/webpages/WEB-INF/classes/ServletParam.java
  
  Index: ServletParam.java
  ===================================================================
  import java.io.*;
  import java.util.*;
  
  import javax.servlet.*;
  import javax.servlet.http.*;
  
  /**
   */
  public class ServletParam extends HttpServlet {
  
      public void doPost (HttpServletRequest req, HttpServletResponse res)
  	throws ServletException, IOException
      {
  	doGet( req, res );
      }
      
      public void doGet (HttpServletRequest req, HttpServletResponse res)
  	throws ServletException, IOException
      {
  	// Should be text/xml !
  	res.setContentType("text/html");
  
  	PrintWriter out = res.getWriter ();
  	out.println("<html>");
  	out.println("<body>");
  
  	out.println("<h1>" + getServletConfig().getServletName() + "</h1>");
  	
  	out.println("<dl>");
  	Enumeration initParams=getInitParameterNames();
  	while( initParams.hasMoreElements()  ) {
  	    String name=(String)initParams.nextElement();
  	    String value=getInitParameter( name );
  	    out.println("<dt>"+name + "</dt><dd>"+ value + "</dd>");
  	}
  	out.println("</dl>");
  	out.println("</body></html>");
  	return;
        }
        
  }
  
  
  

Mime
View raw message