You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by hu...@apache.org on 2004/07/22 15:29:44 UTC

cvs commit: jakarta-struts/src/share/org/apache/struts/util ModuleUtils.java

husted      2004/07/22 06:29:44

  Modified:    src/share/org/apache/struts/util ModuleUtils.java
  Log:
  Apply  #27332  "The bundle attr do not have subapp resolution" submitted by (Richard C. L. Li)
  
  Revision  Changes    Path
  1.9       +15 -19    jakarta-struts/src/share/org/apache/struts/util/ModuleUtils.java
  
  Index: ModuleUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/ModuleUtils.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ModuleUtils.java	14 Mar 2004 06:23:51 -0000	1.8
  +++ ModuleUtils.java	22 Jul 2004 13:29:44 -0000	1.9
  @@ -28,6 +28,7 @@
   import org.apache.struts.Globals;
   import org.apache.struts.action.RequestProcessor;
   import org.apache.struts.config.ModuleConfig;
  +import org.apache.struts.config.MessageResourcesConfig;
   
   /**
    * General purpose utility methods related to module processing.
  @@ -48,12 +49,6 @@
       private static final Log log = LogFactory.getLog(ModuleUtils.class);
   
       /**
  -     * The message resources for this package.
  -     */
  -    private static final MessageResources messages =
  -        MessageResources.getMessageResources("org.apache.struts.util.LocalStrings");
  -
  -    /**
        * Returns the Singleton instance of TagUtils.
        */
       public static ModuleUtils getInstance() {
  @@ -252,15 +247,16 @@
               request.removeAttribute(Globals.MODULE_KEY);
           }
   
  -        MessageResources resources =
  -            (MessageResources) context.getAttribute(Globals.MESSAGES_KEY + prefix);
  -
  -        if (resources != null) {
  -            request.setAttribute(Globals.MESSAGES_KEY, resources);
  -        } else {
  -            request.removeAttribute(Globals.MESSAGES_KEY);
  +        MessageResourcesConfig[] mrConfig = config.findMessageResourcesConfigs();
  +        for(int i = 0; i < mrConfig.length; i++) {
  +          String key = mrConfig[i].getKey();
  +          MessageResources resources =
  +            (MessageResources) context.getAttribute(key + prefix);
  +          if (resources != null) {
  +              request.setAttribute(key, resources);
  +          } else {
  +              request.removeAttribute(key);
  +          }
           }
  -
       }
  -
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org