You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by cr...@locus.apache.org on 2000/11/04 02:53:23 UTC

cvs commit: jakarta-struts/src/share/org/apache/struts/action ActionServlet.java

craigmcc    00/11/03 17:53:22

  Modified:    src/share/org/apache/struts/action ActionServlet.java
  Log:
  Make it possible to use the controller servlet as the target of a
  RequestDispatcher.include() or <jsp:include> call.  Previously, the
  controller servlet would mistakenly use the request URI of the original
  request, rather than the included path, when calculating which action
  to execute.
  
  Submitted by: Colin Sampaleanu <co...@Bspark.com>
  
  Revision  Changes    Path
  1.32      +12 -6     jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java
  
  Index: ActionServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- ActionServlet.java	2000/10/16 03:39:28	1.31
  +++ ActionServlet.java	2000/11/04 01:53:22	1.32
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java,v 1.31 2000/10/16 03:39:28 craigmcc Exp $
  - * $Revision: 1.31 $
  - * $Date: 2000/10/16 03:39:28 $
  + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java,v 1.32 2000/11/04 01:53:22 craigmcc Exp $
  + * $Revision: 1.32 $
  + * $Date: 2000/11/04 01:53:22 $
    *
    * ====================================================================
    *
  @@ -200,7 +200,7 @@
    * </ul>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.31 $ $Date: 2000/10/16 03:39:28 $
  + * @version $Revision: 1.32 $ $Date: 2000/11/04 01:53:22 $
    */
   
   public class ActionServlet
  @@ -1351,12 +1351,18 @@
   	String path = null;
   
   	// For prefix matching, we want to match on the path info (if any)
  -	path = request.getPathInfo();
  +        path =
  +            (String) request.getAttribute("javax.servlet.include.path_info");
  +        if (path == null)
  +            path = request.getPathInfo();
   	if ((path != null) && (path.length() > 0))
   	    return (path);
   
   	// For extension matching, we want to strip the extension (if any)
  -	path = request.getServletPath();
  +        path =
  +           (String) request.getAttribute("javax.servlet.include.servlet_path");
  +        if (path == null)
  +            path = request.getServletPath();
   	int slash = path.lastIndexOf("/");
   	int period = path.lastIndexOf(".");
   	if ((period >= 0) && (period > slash))