[prev in list] [next in list] [prev in thread] [next in thread] 

List:       struts-dev
Subject:    cvs commit: jakarta-struts/src/share/org/apache/struts/actions LookupDispatchAction.java
From:       husted () apache ! org
Date:       2003-08-31 23:53:36
[Download RAW message or body]

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: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic