struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgra...@apache.org
Subject cvs commit: jakarta-struts/src/share/org/apache/struts/util RequestUtils.java
Date Mon, 18 Nov 2002 02:52:12 GMT
dgraham     2002/11/17 18:52:12

  Modified:    src/share/org/apache/struts/util RequestUtils.java
  Log:
  Changed present() to check in request scope after checking page scope but 
  before checking application scope.
  Bugzilla PR: 14092
  
  Revision  Changes    Path
  1.72      +25 -11    jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java
  
  Index: RequestUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/util/RequestUtils.java,v
  retrieving revision 1.71
  retrieving revision 1.72
  diff -u -r1.71 -r1.72
  --- RequestUtils.java	12 Nov 2002 03:56:09 -0000	1.71
  +++ RequestUtils.java	18 Nov 2002 02:52:11 -0000	1.72
  @@ -1077,31 +1077,45 @@
   
           MessageResources resources = null;
   
  -        // Look up the requested MessageResources
  +        // Look up the requested MessageResources in page scope
           if (bundle == null) {
               bundle = Globals.MESSAGES_KEY;
  -            resources = (MessageResources) pageContext.getAttribute(bundle);
  +            resources =
  +                (MessageResources) pageContext.getAttribute(bundle, PageContext.PAGE_SCOPE);
  +        }
  +
  +        // Look up the requested MessageResources in request scope
  +        if (resources == null) {
  +            resources =
  +                (MessageResources) pageContext.getAttribute(bundle, PageContext.REQUEST_SCOPE);
           }
  +
  +        // Look up the requested MessageResources in application scope
           if (resources == null) {
               resources =
                   (MessageResources) pageContext.getAttribute(bundle, PageContext.APPLICATION_SCOPE);
           }
  +
  +        // Not found in any scope
           if (resources == null) {
               JspException e = new JspException(messages.getMessage("message.bundle", bundle));
               saveException(pageContext, e);
               throw e;
           }
  -
  +        
           // Look up the requested Locale
  -        if (locale == null)
  +        if (locale == null) {
               locale = Globals.LOCALE_KEY;
  +        }
  +        
           Locale userLocale = (Locale) pageContext.getAttribute(locale, PageContext.SESSION_SCOPE);
  -        if (userLocale == null)
  +        
  +        if (userLocale == null) {
               userLocale = defaultLocale;
  -
  +        }
  +        
           // Return the requested message presence indicator
           return (resources.isPresent(userLocale, key));
  -
       }
   
       /**
  
  
  

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


Mime
View raw message