tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@apache.org
Subject cvs commit: jakarta-tomcat/src/tests/webpages error402.html
Date Sun, 11 Mar 2001 21:41:41 GMT
nacho       01/03/11 13:41:41

  Modified:    src/tests/webpages/WEB-INF web.xml test-tomcat.xml
  Added:       src/tests/webpages/WEB-INF/classes error402.java
               src/tests/share/tests/jsp/Golden error402.html.txt
               src/tests/webpages error402.html
  Log:
  Test for Bugzilla#291
  
  Using an html file as the <location> in an <error-page>
  in web.xml causes a StackOverflowError. BugRat Report#538
  
  Reported by: Catherine.Jung@netcentricsystems.net (Catherine Jung)
  
  Actually the fail obtained in Tomcat 3.3 is not the one reported,
  this report was for 3.2.1
  
  But it's actually a bug in the error handling in TC3.3, when a error is redirected
  to a html page, the static interceptor actually gives a not found error (404), because
  the passed request is the old request uri  ( the one of the failing servlet )
  not the html  error page,  thus giving a 402.
  
  i will try to reproduce  it on 3.2.2 too.
  
  Revision  Changes    Path
  1.9       +139 -151  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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- web.xml	2000/12/13 19:58:04	1.8
  +++ web.xml	2001/03/11 21:41:41	1.9
  @@ -1,219 +1,207 @@
   <?xml version="1.0" encoding="ISO-8859-1"?>
  -
  -<!DOCTYPE web-app
  -    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
  +<!-- edited with XML Spy v3.0 NT (http://www.xmlspy.com) by Hippo (Hippo Ltd.) -->
  +<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
       "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
  -
   <web-app>
  -    <servlet>
  -        <servlet-name>
  +	<servlet>
  +		<servlet-name>
               servlet1
           </servlet-name>
  -        <servlet-class>
  +		<servlet-class>
               requestMap.Servlet1
           </servlet-class>
  -    </servlet>
  -    <servlet>
  -        <servlet-name>
  +	</servlet>
  +	<servlet>
  +		<servlet-name>
               servlet2
           </servlet-name>
  -        <servlet-class>
  +		<servlet-class>
               requestMap.Servlet2
           </servlet-class>
  -    </servlet>
  -    <servlet>
  -        <servlet-name>
  +	</servlet>
  +	<servlet>
  +		<servlet-name>
               servlet3
           </servlet-name>
  -        <servlet-class>
  +		<servlet-class>
               requestMap.Servlet3
           </servlet-class>
  -    </servlet>
  -    <servlet>
  -        <servlet-name>
  +	</servlet>
  +	<servlet>
  +		<servlet-name>
               servlet4
           </servlet-name>
  -        <servlet-class>
  +		<servlet-class>
               requestMap.Servlet4
           </servlet-class>
  -    </servlet>
  -
  -        <servlet>
  -      <servlet-name>
  +	</servlet>
  +	<servlet>
  +		<servlet-name>
             jspParams1
         </servlet-name>
  -      <jsp-file>
  +		<jsp-file>
             /jsp/params.jsp
         </jsp-file>
  -      <init-param>
  -        <param-name>abc</param-name>
  -        <param-value>def</param-value>
  -      </init-param>
  -    </servlet>
  -    <servlet>
  -      <servlet-name>
  +		<init-param>
  +			<param-name>abc</param-name>
  +			<param-value>def</param-value>
  +		</init-param>
  +	</servlet>
  +	<servlet>
  +		<servlet-name>
             jspParams2.jsp
         </servlet-name>
  -      <jsp-file>
  +		<jsp-file>
             /jsp/params.jsp
         </jsp-file>
  -      <init-param>
  -        <param-name>xyz</param-name>
  -        <param-value>klm</param-value>
  -      </init-param>
  -    </servlet>
  -    <servlet>
  -      <servlet-name>
  +		<init-param>
  +			<param-name>xyz</param-name>
  +			<param-value>klm</param-value>
  +		</init-param>
  +	</servlet>
  +	<servlet>
  +		<servlet-name>
             jspParams3
         </servlet-name>
  -      <jsp-file>
  +		<jsp-file>
             /jsp/params.jsp
         </jsp-file>
  -      <init-param>
  -        <param-name>foo</param-name>
  -        <param-value>bar</param-value>
  -      </init-param>
  -      <init-param>
  -        <param-name>foo1</param-name>
  -        <param-value>bar1</param-value>
  -      </init-param>
  -    </servlet>
  -    
  -     <servlet-mapping>
  -        <servlet-name>
  +		<init-param>
  +			<param-name>foo</param-name>
  +			<param-value>bar</param-value>
  +		</init-param>
  +		<init-param>
  +			<param-name>foo1</param-name>
  +			<param-value>bar1</param-value>
  +		</init-param>
  +	</servlet>
  +	<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>
  +	<servlet-mapping>
  +		<servlet-name>
              jspParams1            
           </servlet-name>
  -        <url-pattern>
  +		<url-pattern>
               /jsp/jspParams1
           </url-pattern>
  -    </servlet-mapping>
  -    <servlet-mapping>
  -        <servlet-name>
  +	</servlet-mapping>
  +	<servlet-mapping>
  +		<servlet-name>
              jspParams1            
           </servlet-name>
  -        <url-pattern>
  +		<url-pattern>
               /jsp/jspParams11
           </url-pattern>
  -    </servlet-mapping>
  -
  -    <servlet-mapping>
  -        <servlet-name>
  +	</servlet-mapping>
  +	<servlet-mapping>
  +		<servlet-name>
              jspParams2.jsp            
           </servlet-name>
  -        <url-pattern>
  +		<url-pattern>
               /jsp/jspParams2
           </url-pattern>
  -    </servlet-mapping>
  -
  -    <servlet-mapping>
  -        <servlet-name>
  +	</servlet-mapping>
  +	<servlet-mapping>
  +		<servlet-name>
              jspParams2.jsp            
           </servlet-name>
  -        <url-pattern>
  +		<url-pattern>
               /jsp/jspParams2.jsp
           </url-pattern>
  -    </servlet-mapping>
  -
  -    <servlet-mapping>
  -        <servlet-name>
  +	</servlet-mapping>
  +	<servlet-mapping>
  +		<servlet-name>
              jspParams3            
           </servlet-name>
  -        <url-pattern>
  +		<url-pattern>
               /jsp/jspParams3
           </url-pattern>
  -    </servlet-mapping>
  -
  -
  -
  -    <servlet-mapping>
  -        <servlet-name>
  +	</servlet-mapping>
  +	<servlet-mapping>
  +		<servlet-name>
               servlet1
           </servlet-name>
  -        <url-pattern>
  +		<url-pattern>
               /foo/bar/*
           </url-pattern>
  -    </servlet-mapping>
  -    <servlet-mapping>
  -        <servlet-name>
  +	</servlet-mapping>
  +	<servlet-mapping>
  +		<servlet-name>
               servlet2
           </servlet-name>
  -        <url-pattern>
  +		<url-pattern>
               /baz/*
           </url-pattern>
  -    </servlet-mapping>
  -    <servlet-mapping>
  -        <servlet-name>
  +	</servlet-mapping>
  +	<servlet-mapping>
  +		<servlet-name>
               servlet3
           </servlet-name>
  -        <url-pattern>
  +		<url-pattern>
               /catalog
           </url-pattern>
  -    </servlet-mapping>
  -    <servlet-mapping>
  -        <servlet-name>
  +	</servlet-mapping>
  +	<servlet-mapping>
  +		<servlet-name>
               servlet4
           </servlet-name>
  -        <url-pattern>
  +		<url-pattern>
               *.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>          
  -
  -    <security-constraint>
  -      <web-resource-collection>
  -         <web-resource-name>a</web-resource-name>
  -         <url-pattern>/foo1/*</url-pattern>
  -         <url-pattern>/bar1/*</url-pattern>
  -         <http-method>GET</http-method>
  -         <http-method>POST</http-method>
  -      </web-resource-collection>
  -
  -      <web-resource-collection>
  -         <web-resource-name>a</web-resource-name>
  -         <url-pattern>/foo2/*</url-pattern>
  -         <url-pattern>/bar2/*</url-pattern>
  -      </web-resource-collection>
  -
  -      <auth-constraint>
  -         <role-name>manager</role-name>
  -         <role-name>role1</role-name>
  -      </auth-constraint>
  -
  -      <user-data-constraint>
  -         <transport-guarantee>CONFIDENTIAL</transport-guarantee>
  -      </user-data-constraint>
  -    </security-constraint>
  +	</servlet-mapping>
  +	<error-page>
  +		<error-code>402</error-code>
  +		<location>/error402.html</location>
  +	</error-page>
  +	<security-constraint>
  +		<web-resource-collection>
  +			<web-resource-name>a</web-resource-name>
  +			<url-pattern>/foo1/*</url-pattern>
  +			<url-pattern>/bar1/*</url-pattern>
  +			<http-method>GET</http-method>
  +			<http-method>POST</http-method>
  +		</web-resource-collection>
  +		<web-resource-collection>
  +			<web-resource-name>a</web-resource-name>
  +			<url-pattern>/foo2/*</url-pattern>
  +			<url-pattern>/bar2/*</url-pattern>
  +		</web-resource-collection>
  +		<auth-constraint>
  +			<role-name>manager</role-name>
  +			<role-name>role1</role-name>
  +		</auth-constraint>
  +		<user-data-constraint>
  +			<transport-guarantee>CONFIDENTIAL</transport-guarantee>
  +		</user-data-constraint>
  +	</security-constraint>
   </web-app>
  
  
  
  1.28      +9 -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.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- test-tomcat.xml	2001/03/03 22:08:16	1.27
  +++ test-tomcat.xml	2001/03/11 21:41:41	1.28
  @@ -16,7 +16,7 @@
           early tests.
       -->
   
  -     <property name="revision" value="$Revision: 1.27 $" />  
  +     <property name="revision" value="$Revision: 1.28 $" />  
        <property name="host" value="127.0.0.1" />
        <property name="port"     value="8080" />
        <property name="outputType"     value="text" />
  @@ -349,6 +349,14 @@
                returnCode="${http.protocol} 200"
                goldenFile="${gdir}/SimpleForward.txt" 
          />
  +
  +      <httpClient>
  +          <comment>Dispatch to html error page using error-page web.xml element</comment>
  +          <httpRequest path="/test/servlet/error402" />
  +          <httpStatusMatch match="402" />
  +          <headerMatch name="Content-Type" value="text/html" />
  +          <goldenMatch file="${gdir}/error402.html.txt"/>
  +      </httpClient>
   
         <!-- Removed: the test calls RequestDispatcher.include(), and 
              the included servlet throws an exception. 
  
  
  
  1.1                  jakarta-tomcat/src/tests/webpages/WEB-INF/classes/error402.java
  
  Index: error402.java
  ===================================================================
  import javax.servlet.*;
  import javax.servlet.http.*;
  import java.io.*;
  
  public class error402 extends HttpServlet {
  
      public void init(ServletConfig conf)
          throws ServletException
      {
          super.init(conf);
      }
  
      public void service(HttpServletRequest req, HttpServletResponse res)
          throws ServletException, IOException
      {
           res.sendError(HttpServletResponse.SC_PAYMENT_REQUIRED);
      }
  }
  
  
  
  1.1                  jakarta-tomcat/src/tests/share/tests/jsp/Golden/error402.html.txt
  
  Index: error402.html.txt
  ===================================================================
  <html>
  <title>402 error page</title>
  
  <body>
  
  <h2>This is the test error page for the 402 error </h2>
  
  </body>
  </html>
  
  
  1.1                  jakarta-tomcat/src/tests/webpages/error402.html
  
  Index: error402.html
  ===================================================================
  <html>
  <title>402 error page</title>
  
  <body>
  
  <h2>This is the test error page for the 402 error </h2>
  
  </body>
  </html>
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, email: tomcat-dev-help@jakarta.apache.org


Mime
View raw message