jon         02/03/04 17:30:03

  Modified:    src/java/org/apache/turbine/modules ActionEvent.java
  Log:
  The attached patch supports using image buttons to initiate
  events regardless of your setting for url.case.folding.
  
  The existing code only handles image buttons if you are using
  some form of url case folding.
  
  Scott Finnerty <[EMAIL PROTECTED]>
  
  -------------------------------------------------------------------------
  
  note that i also changed:
  
          String fold =
              Turbine.getConfiguration().getString(
                  Turbine.PP_URL_CASE_FOLDING,
                  "").toLowerCase();
  
  to:
  
          String fold =
              Turbine.getConfiguration().getString(
                  Turbine.PP_URL_CASE_FOLDING,
                  "ParameterParser.URL_CASE_FOLDING_LOWER").toLowerCase();
  
  the default TurbineResources.properties sets the default value to LOWER so
  we might as well also hard code that into the file. This makes it so that
  we can remove a null and length check because a default value will always
  be assigned.
  
  -jon
  
  Revision  Changes    Path
  1.2       +16 -16    
jakarta-turbine-3/src/java/org/apache/turbine/modules/ActionEvent.java
  
  Index: ActionEvent.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-3/src/java/org/apache/turbine/modules/ActionEvent.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ActionEvent.java  16 Aug 2001 04:41:34 -0000      1.1
  +++ ActionEvent.java  5 Mar 2002 01:30:03 -0000       1.2
  @@ -100,7 +100,7 @@
    * method naming in your Action class.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jon S. Stevens </a>
  - * @version $Id: ActionEvent.java,v 1.1 2001/08/16 04:41:34 jvanzyl Exp $
  + * @version $Id: ActionEvent.java,v 1.2 2002/03/05 01:30:03 jon Exp $
    */
   public abstract class ActionEvent
       extends Action
  @@ -204,29 +204,29 @@
        */
       protected final String formatString(String input)
       {
  +        String methodName = input;
  +        
  +        // check for image submission
  +        if (input.endsWith(".x") || input.endsWith(".y"))
  +        {
  +           methodName = methodName.substring(0, input.length() - 2);
  +        }
  +        
           String fold =
               Turbine.getConfiguration().getString(
  -                Turbine.PP_URL_CASE_FOLDING, "").toLowerCase();
  +                Turbine.PP_URL_CASE_FOLDING, 
  +                "ParameterParser.URL_CASE_FOLDING_LOWER").toLowerCase();
   
  -        if ((fold == null) ||
  -            (fold.length()==0) ||
  -            (! fold.equals(ParameterParser.URL_CASE_FOLDING_NONE)))
  +        if (! fold.equals(ParameterParser.URL_CASE_FOLDING_NONE))
           {
  -            String tmp = input;
  -
  -            // Chop off suffixes (for image type)
  -            if (input.endsWith(".x") || input.endsWith(".y"))
  -            {
  -               tmp = tmp.substring(0, input.length() - 2);
  -            }
  -            // Chop off the prefixes.
  -            tmp = tmp.substring(BUTTON_LENGTH + METHOD_NAME_LENGTH);
  +            methodName = 
  +                methodName.substring(BUTTON_LENGTH + METHOD_NAME_LENGTH);
   
  -            return (METHOD_NAME_PREFIX + firstLetterCaps(tmp));
  +            return (METHOD_NAME_PREFIX + firstLetterCaps(methodName));
           }
           else
           {
  -            return input.substring(BUTTON_LENGTH);
  +            return methodName.substring(BUTTON_LENGTH);
           }
       }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to