myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r1523378 - /myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java
Date Sun, 15 Sep 2013 01:10:45 GMT
Author: lu4242
Date: Sun Sep 15 01:10:45 2013
New Revision: 1523378

URL: http://svn.apache.org/r1523378
Log:
MYFACES-3722 Cache for ResourceHandlerImpl.isResourceRequest seams not to work in 'none resource
requests' (Thanks to Dennis Hoersch for provide this patch)

Modified:
    myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java

Modified: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java?rev=1523378&r1=1523377&r2=1523378&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java
(original)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java
Sun Sep 15 01:10:45 2013
@@ -465,32 +465,20 @@ public class ResourceHandlerImpl extends
     public boolean isResourceRequest(FacesContext facesContext)
     {
         // Since this method could be called many times we save it
-        //on request map so the first time is calculated it remains
-        //alive until the end of the request
+        // on request map so the first time is calculated it remains
+        // alive until the end of the request
         Boolean value = (Boolean) facesContext.getAttributes().get(IS_RESOURCE_REQUEST);
 
-        if (value != null && value)
-        {
-            //return the saved value
-            return value;
-        }
-        else
+        if (value == null)
         {
             String resourceBasePath = getResourceHandlerSupport()
                     .calculateResourceBasePath(facesContext);
 
-            if (resourceBasePath != null
-                    && resourceBasePath.startsWith(ResourceHandler.RESOURCE_IDENTIFIER))
-            {
-                facesContext.getAttributes().put(IS_RESOURCE_REQUEST, Boolean.TRUE);
-                return true;
-            }
-            else
-            {
-                facesContext.getAttributes().put(IS_RESOURCE_REQUEST, Boolean.FALSE);
-                return false;
-            }
+            value = resourceBasePath != null
+                    && resourceBasePath.startsWith(ResourceHandler.RESOURCE_IDENTIFIER);
+            facesContext.getAttributes().put(IS_RESOURCE_REQUEST, value);
         }
+        return value;
     }
 
     protected String getLocalePrefixForLocateResource()



Mime
View raw message