tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/tester/web/WEB-INF web.xml
Date Wed, 30 May 2001 19:42:50 GMT
craigmcc    01/05/30 12:42:50

  Modified:    tester/src/bin tester.xml
               tester/web/WEB-INF web.xml
  Added:       tester/src/tester/org/apache/tester FilterResponse01.java
                        UpperCaseFilter.java UpperCaseOutputStream.java
                        UpperCaseResponse.java UpperCaseWriter.java
               tester/web FilterResponse02.jsp FilterResponse03.txt
                        WrappedFilterResponse02.jsp
                        WrappedFilterResponse03.txt
  Log:
  Add some unit tests for a filter that wraps the response (and converts all
  characters to upper case).  Wrapped output is tested from a servlet, a JSP
  page, and a static file -- all accessed directly or with the second
  wrapper filter used on most unit tests.
  
  This all works with the standard test client (HTTP/1.0 only), so it
  doesn't test all the scenarios currently being reported on TOMCAT-DEV.
  I'm going to explore those next.
  
  Revision  Changes    Path
  1.47      +47 -1     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.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- tester.xml	2001/05/29 17:55:31	1.46
  +++ tester.xml	2001/05/30 19:42:44	1.47
  @@ -15,7 +15,7 @@
     <taskdef  name="tester"     classname="org.apache.tester.TestClient"/>
   
   
  -  <target name="all" depends="ROOT,Authentication,CaseSensitive,Decoding,ErrorPage,Jndi,RequestDispatcher,Resources,ServletRequest,ServletResponse,HttpSession,XercesTest,SSITest"/>
  +  <target name="all" depends="ROOT,Authentication,CaseSensitive,Decoding,ErrorPage,FilterResponse,Jndi,RequestDispatcher,Resources,ServletRequest,ServletResponse,HttpSession,XercesTest,SSITest"/>
   
   
     <target name="ROOT">
  @@ -343,6 +343,52 @@
             status="200"
         outContent="ErrorPage10 PASSED"/>
   
  +
  +  </target>
  +
  +
  +  <target name="FilterResponse">
  +
  +    <!-- ========== Apply Upper Case Filter =============================== -->
  +
  +    <!-- Output from a servlet -->
  +    <tester host="${host}" port="${port}" protocol="${protocol}"
  +         request="${context.path}/FilterResponse01"
  +           debug="${debug}"
  +          status="200"
  +      outContent="FILTERRESPONSE01 PASSED"/>
  +
  +    <tester host="${host}" port="${port}" protocol="${protocol}"
  +         request="${context.path}/WrappedFilterResponse01"
  +           debug="${debug}"
  +          status="200"
  +      outContent="FILTERRESPONSE01 PASSED"/>
  +
  +    <!-- Output from a JSP Page -->
  +    <tester host="${host}" port="${port}" protocol="${protocol}"
  +         request="${context.path}/FilterResponse02.jsp"
  +           debug="${debug}"
  +          status="200"
  +      outContent="FILTERRESPONSE02 PASSED"/>
  +
  +    <tester host="${host}" port="${port}" protocol="${protocol}"
  +         request="${context.path}/WrappedFilterResponse02.jsp"
  +           debug="${debug}"
  +          status="200"
  +      outContent="FILTERRESPONSE02 PASSED"/>
  +
  +    <!-- Output from a static page -->
  +    <tester host="${host}" port="${port}" protocol="${protocol}"
  +         request="${context.path}/FilterResponse03.txt"
  +           debug="${debug}"
  +          status="200"
  +      outContent="FILTERRESPONSE03 PASSED"/>
  +
  +    <tester host="${host}" port="${port}" protocol="${protocol}"
  +         request="${context.path}/WrappedFilterResponse03.txt"
  +           debug="${debug}"
  +          status="200"
  +      outContent="FILTERRESPONSE03 PASSED"/>
   
     </target>
   
  
  
  
  1.1                  jakarta-tomcat-4.0/tester/src/tester/org/apache/tester/FilterResponse01.java
  
  Index: FilterResponse01.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 <apache@apache.org>.                        *
   *                                                                           *
   * 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 java.lang.reflect.*;
  import java.util.*;
  import javax.servlet.*;
  import javax.servlet.http.*;
  
  
  /**
   * Positive test for being able to filter output.  The output should be
   * filtered and converted to upper case before return to the client.
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2001/05/30 19:42:46 $
   */
  
  public class FilterResponse01 extends HttpServlet {
  
      public void service(HttpServletRequest request,
                          HttpServletResponse response)
          throws IOException, ServletException {
  
          response.setContentType("text/plain");
          PrintWriter writer = response.getWriter();
  
          writer.println("FilterResponse01 PASSED");
          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/UpperCaseFilter.java
  
  Index: UpperCaseFilter.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 <apache@apache.org>.                        *
   *                                                                           *
   * 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 java.util.*;
  import javax.servlet.*;
  import javax.servlet.http.*;
  
  
  /**
   * Filter that simply transforms its output to upper case.
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2001/05/30 19:42:46 $
   */
  
  public class UpperCaseFilter implements Filter {
  
  
      private FilterConfig config = null;
  
      public void destroy() {
          ; // No action required
      }
  
      public void init(FilterConfig config) throws ServletException {
          this.config = config;
      }
  
      public void doFilter(ServletRequest request, ServletResponse response,
                           FilterChain chain)
          throws IOException, ServletException {
  
          HttpServletResponse wresponse =
              new UpperCaseResponse((HttpServletResponse) response);
          StaticLogger.write("UpperCaseFilter.doFilter() begin");
          chain.doFilter(request, wresponse);
          StaticLogger.write("UpperCaseFilter.doFilter() end");
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-tomcat-4.0/tester/src/tester/org/apache/tester/UpperCaseOutputStream.java
  
  Index: UpperCaseOutputStream.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 <apache@apache.org>.                        *
   *                                                                           *
   * 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 java.util.*;
  import javax.servlet.*;
  import javax.servlet.http.*;
  
  
  /**
   * ServletOutputStream that converts all characters to upper case.
   * WARNING:  This will only work on 8-bit character sets!
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2001/05/30 19:42:46 $
   */
  
  public class UpperCaseOutputStream extends ServletOutputStream {
  
      ServletOutputStream stream = null;
  
      public UpperCaseOutputStream(ServletOutputStream stream)
        throws IOException {
          super();
          this.stream = stream;
      }
  
      public void write(int c) throws IOException {
          char ch = (char) c;
          if (Character.isLowerCase(ch))
              ch = Character.toUpperCase(ch);
          stream.write((int) ch);
      }
  
      public void write(byte buf[], int off, int len) throws IOException {
          for (int i = off; i < (off + len); i++) {
              char ch = (char) buf[i];
              if (Character.isLowerCase(ch))
                  ch = Character.toUpperCase(ch);
              stream.write((int) ch);
          }
      }
  
      public void write(byte buf[]) throws IOException {
          write(buf, 0, buf.length);
      }
  
  }
  
  
  
  
  1.1                  jakarta-tomcat-4.0/tester/src/tester/org/apache/tester/UpperCaseResponse.java
  
  Index: UpperCaseResponse.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 <apache@apache.org>.                        *
   *                                                                           *
   * 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 java.util.*;
  import javax.servlet.*;
  import javax.servlet.http.*;
  
  
  /**
   * HttpServletResponse wrapper that converts all output characters to
   * upper case.
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2001/05/30 19:42:46 $
   */
  
  public class UpperCaseResponse extends HttpServletResponseWrapper {
  
  
      HttpServletResponse response = null;
  
      public UpperCaseResponse(HttpServletResponse response) {
          super(response);
          this.response = response;
      }
  
      public ServletOutputStream getOutputStream() throws IOException {
          return (new UpperCaseOutputStream(response.getOutputStream()));
      }
  
      public PrintWriter getWriter() throws IOException {
          return (new UpperCaseWriter(response.getWriter()));
      }
  
  
  }
  
  
  
  
  
  
  1.1                  jakarta-tomcat-4.0/tester/src/tester/org/apache/tester/UpperCaseWriter.java
  
  Index: UpperCaseWriter.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 <apache@apache.org>.                        *
   *                                                                           *
   * 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 java.util.*;
  import javax.servlet.*;
  import javax.servlet.http.*;
  
  
  /**
   * PrintWriter that converts all characters to upper case.
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2001/05/30 19:42:46 $
   */
  
  public class UpperCaseWriter extends PrintWriter {
  
  
      public UpperCaseWriter(PrintWriter writer) throws IOException {
          super(writer);
      }
  
      public void write(int c) {
          char ch = (char) c;
          if (Character.isLowerCase(ch))
              ch = Character.toUpperCase(ch);
          super.write((int) ch);
      }
  
      public void write(char buf[], int off, int len) {
          for (int i = off; i < (off + len); i++) {
              char ch = buf[i];
              if (Character.isLowerCase(ch))
                  ch = Character.toUpperCase(ch);
              super.write((int) ch);
          }
      }
  
      public void write(char buf[]) {
          write(buf, 0, buf.length);
      }
  
      public void write(String s, int off, int len) {
          for (int i = off; i < (off + len); i++) {
              char ch = s.charAt(i);
              if (Character.isLowerCase(ch))
                  ch = Character.toUpperCase(ch);
              super.write((int) ch);
          }
      }
  
      public void write(String s) {
          write(s, 0, s.length());
      }
  
  
  }
  
  
  
  
  1.1                  jakarta-tomcat-4.0/tester/web/FilterResponse02.jsp
  
  Index: FilterResponse02.jsp
  ===================================================================
  <%@ page contentType="text/plain" %>FilterResponse02 PASSED
  <%
          while (true) {
              String message = org.apache.tester.StaticLogger.read();
              if (message == null)
                  break;
              out.println(message);
          }
          org.apache.tester.StaticLogger.reset();
  %>
  
  
  
  1.1                  jakarta-tomcat-4.0/tester/web/FilterResponse03.txt
  
  Index: FilterResponse03.txt
  ===================================================================
  FilterResponse03 PASSED
  
  
  
  1.1                  jakarta-tomcat-4.0/tester/web/WrappedFilterResponse02.jsp
  
  Index: WrappedFilterResponse02.jsp
  ===================================================================
  <%@ page contentType="text/plain" %>FilterResponse02 PASSED
  
  
  
  1.1                  jakarta-tomcat-4.0/tester/web/WrappedFilterResponse03.txt
  
  Index: WrappedFilterResponse03.txt
  ===================================================================
  FilterResponse03 PASSED
  
  
  
  1.36      +66 -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.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- web.xml	2001/05/29 17:55:37	1.35
  +++ web.xml	2001/05/30 19:42:49	1.36
  @@ -44,6 +44,12 @@
       </filter>
   
   
  +    <filter>
  +        <filter-name>UpperCaseFilter</filter-name>
  +        <filter-class>org.apache.tester.UpperCaseFilter</filter-class>
  +    </filter>
  +
  +
       <!-- ========== Filter Mappings ======================================= -->
   
       <!-- Use StaticFilter on *all* requests to clear static log -->
  @@ -113,7 +119,52 @@
       </filter-mapping>
   
       <filter-mapping>
  +        <filter-name>UpperCaseFilter</filter-name>
  +        <url-pattern>/FilterResponse01</url-pattern>
  +    </filter-mapping>
  +
  +    <filter-mapping>
           <filter-name>HttpFilter</filter-name>
  +        <url-pattern>/WrappedFilterResponse01</url-pattern>
  +    </filter-mapping>
  +
  +    <filter-mapping>
  +        <filter-name>UpperCaseFilter</filter-name>
  +        <url-pattern>/WrappedFilterResponse01</url-pattern>
  +    </filter-mapping>
  +
  +    <filter-mapping>
  +        <filter-name>UpperCaseFilter</filter-name>
  +        <url-pattern>/FilterResponse02.jsp</url-pattern>
  +    </filter-mapping>
  +
  +    <filter-mapping>
  +        <filter-name>HttpFilter</filter-name>
  +        <url-pattern>/WrappedFilterResponse02.jsp</url-pattern>
  +    </filter-mapping>
  +
  +    <filter-mapping>
  +        <filter-name>UpperCaseFilter</filter-name>
  +        <url-pattern>/WrappedFilterResponse02.jsp</url-pattern>
  +    </filter-mapping>
  +
  +    <filter-mapping>
  +        <filter-name>UpperCaseFilter</filter-name>
  +        <url-pattern>/FilterResponse03.txt</url-pattern>
  +    </filter-mapping>
  +
  +    <filter-mapping>
  +        <filter-name>HttpFilter</filter-name>
  +        <url-pattern>/WrappedFilterResponse03.txt</url-pattern>
  +    </filter-mapping>
  +
  +    <filter-mapping>
  +        <filter-name>UpperCaseFilter</filter-name>
  +        <url-pattern>/WrappedFilterResponse03.txt</url-pattern>
  +    </filter-mapping>
  +
  +    <filter-mapping>
  +        <filter-name>HttpFilter</filter-name>
           <url-pattern>/WrappedForward00</url-pattern>
       </filter-mapping>
   
  @@ -402,6 +453,11 @@
       </servlet>
   
       <servlet>
  +        <servlet-name>FilterResponse01</servlet-name>
  +        <servlet-class>org.apache.tester.FilterResponse01</servlet-class>
  +    </servlet>
  +
  +    <servlet>
           <servlet-name>Forward00</servlet-name>
           <servlet-class>org.apache.tester.Forward00</servlet-class>
       </servlet>
  @@ -788,6 +844,16 @@
       <servlet-mapping>
           <servlet-name>ErrorPage09</servlet-name>
           <url-pattern>/WrappedErrorPage09</url-pattern>
  +    </servlet-mapping>
  +
  +    <servlet-mapping>
  +        <servlet-name>FilterResponse01</servlet-name>
  +        <url-pattern>/FilterResponse01</url-pattern>
  +    </servlet-mapping>
  +
  +    <servlet-mapping>
  +        <servlet-name>FilterResponse01</servlet-name>
  +        <url-pattern>/WrappedFilterResponse01</url-pattern>
       </servlet-mapping>
   
       <servlet-mapping>
  
  
  

Mime
View raw message