You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2013/09/15 03:11:36 UTC

svn commit: r1523380 - /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java

Author: lu4242
Date: Sun Sep 15 01:11:36 2013
New Revision: 1523380

URL: http://svn.apache.org/r1523380
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/trunk/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java?rev=1523380&r1=1523379&r2=1523380&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java Sun Sep 15 01:11:36 2013
@@ -670,32 +670,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()