You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by la...@apache.org on 2001/10/09 04:31:45 UTC

cvs commit: jakarta-tomcat/src/tests/webpages/dispatch msgTag.jsp

larryi      01/10/08 19:31:45

  Modified:    src/tests/webpages/WEB-INF test-tomcat.xml
  Added:       src/tests/webpages/WEB-INF/classes/dispatch
                        IncludeJspWithTaglib.java MsgTag.java msgtag.tld
               src/tests/webpages/dispatch msgTag.jsp
  Log:
  Add a test insure a RequestDispatcher.include() of a JSP page that uses
  a tag library works (Bugzilla #3961)
  
  Reported by: Michael Pichler
  
  Also, moved/updated "%2Ejsp" test since it now succeeds.
  
  Removed ".jsp/." and ".jsp/foo/.." normalization tests when not standalone.
  Apache and IIS don't normalize this out and give not found errors instead.
  
  Removed some commented out tests for encoded characters following
  jsessionid.  Removed extra "HTTP/1.0" in a couple of httpClient tests.
  
  Revision  Changes    Path
  1.47      +14 -20    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.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- test-tomcat.xml	2001/09/23 02:56:32	1.46
  +++ test-tomcat.xml	2001/10/09 02:31:45	1.47
  @@ -16,7 +16,7 @@
           early tests.
       -->
   
  -     <property name="revision" value="$Revision: 1.46 $" />  
  +     <property name="revision" value="$Revision: 1.47 $" />  
        <property name="host" value="127.0.0.1" />
        <property name="port"     value="8080" />
        <property name="colonPort" value=":${port}" />
  @@ -471,12 +471,19 @@
   
         <httpClient>
             <comment>Get a session and then include a JSP.</comment>
  -          <httpRequest path="/test/servlet/dispatch.IncludeJspWithSession HTTP/1.0" />
  +          <httpRequest path="/test/servlet/dispatch.IncludeJspWithSession" />
             <httpStatusMatch match="200" />
             <responseMatch match="This is an inner file"/>
             <headerMatch name="Set-Cookie" value="JSESSIONID=" />
         </httpClient>
   
  +      <httpClient>
  +          <comment>Include a JSP which uses a taglib.</comment>
  +          <httpRequest path="/test/servlet/dispatch.IncludeJspWithTaglib" />
  +          <httpStatusMatch match="200" />
  +          <responseMatch match="This is a taglib test"/>
  +      </httpClient>
  +
       </target>
   
     <target name="session" depends="init">
  @@ -1186,13 +1193,13 @@
             <httpStatusMatch match="200"/>
             <responseMatch match="getRequestURI: /test/jsp/ShowPathInfo.jsp"/>
         </httpClient>
  -      <httpClient >
  +      <httpClient unless="not.standalone" >
             <httpRequest path="/test/jsp/ShowPathInfo.jsp/." 
   		      method="GET" />
             <httpStatusMatch match="200"/>
             <responseMatch match="getRequestURI: /test/jsp/ShowPathInfo.jsp"/>
         </httpClient>
  -      <httpClient >
  +      <httpClient unless="not.standalone" >
             <httpRequest path="/test/jsp/ShowPathInfo.jsp/foo/.." 
   		      method="GET" />
             <httpStatusMatch match="200"/>
  @@ -1204,26 +1211,17 @@
   		      method="GET" />
             <httpStatusMatch match="404"/>
         </httpClient>
  -<!-- Removed: I see no valid reason for those requests to pass, Apache doesn't 
  -    like this, and it's certainly too strange and on the limit 
         <httpClient >
  -          <httpRequest path="/test/jsp/ShowPathInfo.jsp;jsessionid=%25%2E%2F%5C" 
  +          <httpRequest path="/test/jsp/ShowPathInfo.jsp;jsessionid=123" 
   		      method="GET" />
             <httpStatusMatch match="200"/>
             <responseMatch match="getRequestURI: /test/jsp/ShowPathInfo.jsp"/>
         </httpClient>
  -      <httpClient >
  -          <httpRequest path="/test/js%70/ShowPathInfo.jsp;jsessionid=%25%2E%2F%5C" 
  -		      method="GET" />
  -          <httpStatusMatch match="200"/>
  -          <responseMatch match="getRequestURI: /test/js%70/ShowPathInfo.jsp"/>
  -      </httpClient>
  --->
         <httpClient >
  -          <httpRequest path="/test/jsp/ShowPathInfo.jsp;jsessionid=123" 
  +          <httpRequest path="/test/jsp/HelloWorld%2Ejsp" 
   		      method="GET" />
             <httpStatusMatch match="200"/>
  -          <responseMatch match="getRequestURI: /test/jsp/ShowPathInfo.jsp"/>
  +          <goldenMatch file="${gdir}/HelloWorld.txt" />
         </httpClient>
      </target>
   
  @@ -1311,10 +1309,6 @@
   
         <gtest description="This URL should return 403 Forbidden"
              request="GET /test/jsp/HelloWorld.js%2570 HTTP/1.0"
  -           returnCode="${http.protocol} 40" 
  -      />
  -      <gtest description="This URL should return 403 Forbidden"
  -           request="GET /test/jsp/HelloWorld%2Ejsp HTTP/1.0"
              returnCode="${http.protocol} 40" 
         />
   
  
  
  
  1.1                  jakarta-tomcat/src/tests/webpages/WEB-INF/classes/dispatch/IncludeJspWithTaglib.java
  
  Index: IncludeJspWithTaglib.java
  ===================================================================
  /*
   * $Id: IncludeJspWithTaglib.java,v 1.1 2001/10/09 02:31:45 larryi Exp $
   *
   * Include a jsp that uses a taglib.
   * Make sure XML parser is available to Jasper.
   */
  
  package dispatch;
  
  import java.io.*;
  import javax.servlet.*;
  import javax.servlet.http.*;
  
  public class IncludeJspWithTaglib extends HttpServlet
  
  {
      public void service(HttpServletRequest req, HttpServletResponse res)
          throws ServletException, IOException
      {
          PrintWriter out = res.getWriter();
          res.setContentType("text/plain");
  
          RequestDispatcher rd = getServletContext().getRequestDispatcher("/dispatch/msgTag.jsp");
          rd.include(req,res);
      }
  }
  
  
  
  1.1                  jakarta-tomcat/src/tests/webpages/WEB-INF/classes/dispatch/MsgTag.java
  
  Index: MsgTag.java
  ===================================================================
  package dispatch;
  
  import javax.servlet.jsp.*;
  import javax.servlet.jsp.tagext.*;
  
  public class MsgTag extends TagSupport
  {
      String msg;
  
      public void setMsg(String msg) {
          this.msg = msg;
      }
  
      public int doEndTag()
              throws JspException
      {
          try {
              pageContext.getOut().print(msg);
          } catch (java.io.IOException ex) {
              throw new JspException(ex.toString());
          }
          return EVAL_PAGE;
      }
  }
  
  
  1.1                  jakarta-tomcat/src/tests/webpages/WEB-INF/classes/dispatch/msgtag.tld
  
  Index: msgtag.tld
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1" ?>
  <!DOCTYPE taglib
      PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
      "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
  
  <taglib>
      <tlibversion>1.0</tlibversion>
      <shortname>webAF</shortname>
      <tag>
          <name>MsgTag</name>
          <tagclass>dispatch.MsgTag</tagclass>
          <attribute>
              <name>msg</name>
              <required>true</required>
              <rtexprvalue>true</rtexprvalue>
          </attribute>
      </tag>
  </taglib>
  
  
  
  1.1                  jakarta-tomcat/src/tests/webpages/dispatch/msgTag.jsp
  
  Index: msgTag.jsp
  ===================================================================
  <%@ taglib uri="/WEB-INF/classes/dispatch/msgtag.tld" prefix="msg" %>
  <msg:MsgTag msg="This is a taglib test" />