You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cr...@locus.apache.org on 2000/06/19 18:29:31 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/facade RequestDispatcherImpl.java

craigmcc    00/06/19 09:29:29

  Modified:    src/share/org/apache/jasper Constants.java
               src/share/org/apache/jasper/runtime JspServlet.java
               src/share/org/apache/tomcat/facade
                        RequestDispatcherImpl.java
  Log:
  Fix a "double whammy" bug in Tomcat and Jasper.
  
  The RequestDispatcher.include() implementation was passing an incorrect
  value for the "javax.servlet.include.request_uri" request attribute.  It
  was only passing the context-relative part of the URI, instead of
  including the context path on the front.  This only mattered in non-root
  contexts, but will mess up anyone relying on the correct value there.
  
  Jasper had a related bug that was hidden by this Tomcat problem.  If you
  include a JSP page with a reuest dispatcher, it was using the value
  retrieved from "javax.servlet.include.request_uri" to grab the path to the
  page, instead of the "javax.servlet.include.servlet_path" attribute.
  Fixing the Tomcat bug described above caused this to fail -- the net
  effect was that it doubled the context path in trying to calculate the
  real path to the JSP file, which caused FileNotFoundExceptions.
  
  Revision  Changes    Path
  1.13      +1 -0      jakarta-tomcat/src/share/org/apache/jasper/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/Constants.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Constants.java	2000/05/26 18:55:08	1.12
  +++ Constants.java	2000/06/19 16:29:15	1.13
  @@ -134,6 +134,7 @@
        * uses. 
        */
       public static final String INC_REQUEST_URI = "javax.servlet.include.request_uri";
  +    public static final String INC_SERVLET_PATH = "javax.servlet.include.servlet_path";
       public static final String TMP_DIR = "javax.servlet.context.tempdir";
   
       /**
  
  
  
  1.28      +2 -1      jakarta-tomcat/src/share/org/apache/jasper/runtime/JspServlet.java
  
  Index: JspServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/JspServlet.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- JspServlet.java	2000/06/19 05:00:58	1.27
  +++ JspServlet.java	2000/06/19 16:29:22	1.28
  @@ -374,7 +374,8 @@
       {
   	try {
               String includeUri 
  -                = (String) request.getAttribute(Constants.INC_REQUEST_URI);
  +		//  = (String) request.getAttribute(Constants.INC_REQUEST_URI);
  +                = (String) request.getAttribute(Constants.INC_SERVLET_PATH);
   
               String jspUri;
   
  
  
  
  1.4       +2 -2      jakarta-tomcat/src/share/org/apache/tomcat/facade/RequestDispatcherImpl.java
  
  Index: RequestDispatcherImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/facade/RequestDispatcherImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RequestDispatcherImpl.java	2000/06/16 21:03:31	1.3
  +++ RequestDispatcherImpl.java	2000/06/19 16:29:25	1.4
  @@ -244,8 +244,8 @@
   
   	Object old_request_uri=realRequest.getAttribute("javax.servlet.include.request_uri");
   	realRequest.setAttribute("javax.servlet.include.request_uri",
  -				 path);
  -	// context.getPath() + path );
  +				 //				 path);
  +				 context.getPath() + path );
   
   	Object old_context_path=realRequest.getAttribute("javax.servlet.include.context_path");
   	realRequest.setAttribute("javax.servlet.include.context_path",