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/08/13 05:48:56 UTC

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

craigmcc    00/08/12 20:48:56

  Modified:    src/share/org/apache/struts/action ActionServlet.java
  Log:
  Fix the pattern matching logic that identifies the requested action from
  the path info value (if using prefix matching) or the servlet path value
  (if using extension matching).
  
  Reported by: Christian Glencross
  Patch Submitted by: Pierre Delisle <Pi...@eng.sun.com>
  
  Revision  Changes    Path
  1.18      +14 -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.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- ActionServlet.java	2000/07/17 00:46:39	1.17
  +++ ActionServlet.java	2000/08/13 03:48:56	1.18
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java,v 1.17 2000/07/17 00:46:39 craigmcc Exp $
  - * $Revision: 1.17 $
  - * $Date: 2000/07/17 00:46:39 $
  + * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java,v 1.18 2000/08/13 03:48:56 craigmcc Exp $
  + * $Revision: 1.18 $
  + * $Date: 2000/08/13 03:48:56 $
    *
    * ====================================================================
    *
  @@ -185,7 +185,7 @@
    * </ul>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.17 $ $Date: 2000/07/17 00:46:39 $
  + * @version $Revision: 1.18 $ $Date: 2000/08/13 03:48:56 $
    */
   
   public class ActionServlet
  @@ -850,10 +850,18 @@
        */
       protected String processPath(HttpServletRequest request) {
   
  -	String path = request.getServletPath();
  +	String path = null;
  +
  +	// For prefix matching, we want to match on the path info (if any)
  +	path = request.getPathInfo();
  +	if (path != null)
  +	    return (path);
  +
  +	// For extension matching, we want to strip the extension (if any)
  +	path = request.getServletPath();
   	int slash = path.lastIndexOf("/");
   	int period = path.lastIndexOf(".");
  -	if ((period >= 0) && (period > slash))	// Strip the extenson (if any)
  +	if ((period >= 0) && (period > slash))
   	    path = path.substring(0, period);
   	return (path);