husted      2003/08/31 16:53:36

  Modified:    src/share/org/apache/struts/actions
                        LookupDispatchAction.java
  Log:
  Extend getLookupNameMethod from getMethod so that class is easier to extend, per 
#22847.
  
  Revision  Changes    Path
  1.15      +45 -24    
jakarta-struts/src/share/org/apache/struts/actions/LookupDispatchAction.java
  
  Index: LookupDispatchAction.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/actions/LookupDispatchAction.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- LookupDispatchAction.java 13 Aug 2003 05:29:27 -0000      1.14
  +++ LookupDispatchAction.java 31 Aug 2003 23:53:36 -0000      1.15
  @@ -252,30 +252,19 @@
       protected abstract Map getKeyMethodMap();
   
       /**
  -     * Returns the method name, given a parameter's value.
  +     * Lookup the method name corresponding to the client request's locale.
        *
  -     * @param mapping The ActionMapping used to select this instance
  -     * @param form The optional ActionForm bean for this request (if any)
        * @param request The HTTP request we are processing
  -     * @param response The HTTP response we are creating
  -     * @param parameter The <code>ActionMapping</code> parameter's name
  +     * @param keyName The parameter name to use as the properties key
  +     * @param mapping The ActionMapping used to select this instance
        *
  -     * @return The method's name.
  -     * @since Struts 1.2.1
  -     */
  -    protected String getMethodName(ActionMapping mapping,
  -                                   ActionForm form,
  -                                   HttpServletRequest request,
  -                                   HttpServletResponse response,
  -                                   String parameter)
  -            throws Exception {
  -
  -        // Identify the method name to be dispatched to.
  -        // dispatchMethod() will call unspecified() if name is null
  -        String keyName = request.getParameter(parameter);
  -        if (StringUtils.isEmpty(keyName)) {
  -            return null;
  -        }
  +     * @return The method's localized name.
  +     * @throws ServletException if keyName cannot be resolved
  +     * @since Struts 1.2.0
  +     */ protected String getLookupMapName(HttpServletRequest request,
  +                                          String keyName,
  +                                          ActionMapping mapping)
  +            throws ServletException {
   
           // Based on this request's Locale get the lookupMap
           Map lookupMap = null;
  @@ -308,5 +297,37 @@
   
           return methodName;
       }
  +
  +    /**
  +     * Returns the method name, given a parameter's value.
  +     *
  +     * @param mapping The ActionMapping used to select this instance
  +     * @param form The optional ActionForm bean for this request (if any)
  +     * @param request The HTTP request we are processing
  +     * @param response The HTTP response we are creating
  +     * @param parameter The <code>ActionMapping</code> parameter's name
  +     *
  +     * @return The method's name.
  +     * @since Struts 1.2.0
  +     */
  +    protected String getMethodName(ActionMapping mapping,
  +                                   ActionForm form,
  +                                   HttpServletRequest request,
  +                                   HttpServletResponse response,
  +                                   String parameter)
  +            throws Exception {
  +
  +        // Identify the method name to be dispatched to.
  +        // dispatchMethod() will call unspecified() if name is null
  +        String keyName = request.getParameter(parameter);
  +        if (StringUtils.isEmpty(keyName)) {
  +            return null;
  +        }
  +
  +        String methodName = getLookupMapName(request, keyName, mapping);
  +
  +        return methodName;
  +    }
  +
   
   }
  
  
  

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

Reply via email to