sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asa...@apache.org
Subject svn commit: r1613407 - /sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java
Date Fri, 25 Jul 2014 12:20:35 GMT
Author: asanso
Date: Fri Jul 25 12:20:34 2014
New Revision: 1613407

URL: http://svn.apache.org/r1613407
Log:
SLING-3713 - VanityPathTest testRedirectOnPathWithExtension fails:  Expecting temporary redirect
expected:<302> but was:<404>

Modified:
    sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java

Modified: sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java?rev=1613407&r1=1613406&r2=1613407&view=diff
==============================================================================
--- sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java
(original)
+++ sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java
Fri Jul 25 12:20:34 2014
@@ -200,6 +200,32 @@ public class MapEntries implements Event
         }
     }
 
+    private boolean doNodeAdded(String path, boolean refreshed) {
+        this.initializing.lock();
+        boolean newRefreshed = refreshed;
+        if (!newRefreshed) {
+            resolver.refresh();
+            newRefreshed = true;
+        }
+        try {
+            Resource resource = resolver.getResource(path);
+            final ValueMap props = resource.adaptTo(ValueMap.class);
+            if (props.containsKey("sling:vanityPath")) {
+                doAddVanity(path);
+            }
+            if (props.containsKey("sling:alias")) {
+                doAddAlias(path);
+            }
+            if (path.startsWith(this.mapRoot)) {
+                doUpdateConfiguration();
+            }
+            sendChangeEvent();
+        } finally {
+            this.initializing.unlock();
+        }
+        return newRefreshed;
+    }
+    
     private boolean doAddAttributes(String path, String[] addedAttributes, boolean refreshed)
{
         this.initializing.lock();
         boolean newRefreshed = refreshed;
@@ -598,6 +624,9 @@ public class MapEntries implements Event
                 //need to update the configuration
                 wasResolverRefreshed = doUpdateConfiguration(wasResolverRefreshed);
             }
+        //session.move() is handled differently see also SLING-3713 and    
+        } else if (SlingConstants.TOPIC_RESOURCE_ADDED.equals(event.getTopic()) &&
event.getProperty(SlingConstants.PROPERTY_ADDED_ATTRIBUTES) == null) {
+            wasResolverRefreshed = doNodeAdded(path, wasResolverRefreshed);
         } else {
             String [] addedAttributes = (String []) event.getProperty(SlingConstants.PROPERTY_ADDED_ATTRIBUTES);
             if (addedAttributes != null) {
@@ -1108,6 +1137,7 @@ public class MapEntries implements Event
             filter.append(")");
         }
         filter.append("(").append(EventConstants.EVENT_TOPIC).append("=").append(SlingConstants.TOPIC_RESOURCE_REMOVED).append(")");
+        filter.append("(").append(EventConstants.EVENT_TOPIC).append("=").append(SlingConstants.TOPIC_RESOURCE_ADDED).append(")");
         filter.append(")");
 
         return filter.toString();



Mime
View raw message