Author: asanso
Date: Fri Aug 15 08:25:27 2014
New Revision: 1618115

URL: http://svn.apache.org/r1618115
Log:
SLING-3851 - sling:redirect is not update in the MapEntries internal vanity 
path data structure

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=1618115&r1=1618114&r2=1618115&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 Aug 15 08:25:27 2014
@@ -243,6 +243,9 @@ public class MapEntries implements Event
                     doAddVanity(path); 
                 } else if (PROP_VANITY_ORDER.equals(changedAttribute)) {
                     doUpdateVanityOrder(path, false);
+                } else if (PROP_REDIRECT_EXTERNAL.equals(changedAttribute) 
+                        || 
PROP_REDIRECT_EXTERNAL_REDIRECT_STATUS.equals(changedAttribute)) {
+                    doUpdateRedirectStatus(path);
                 } else if 
(ResourceResolverImpl.PROP_ALIAS.equals(changedAttribute)) {
                     if (enableOptimizeAliasResolution) {
                        doAddAlias(path);
@@ -272,6 +275,9 @@ public class MapEntries implements Event
                     doUpdateVanity(path);
                 } else if (PROP_VANITY_ORDER.equals(changedAttribute)) {
                     doUpdateVanityOrder(path, false);
+                } else if (PROP_REDIRECT_EXTERNAL.equals(changedAttribute)
+                        || 
PROP_REDIRECT_EXTERNAL_REDIRECT_STATUS.equals(changedAttribute)) {
+                    doUpdateRedirectStatus(path);
                 } else if 
(ResourceResolverImpl.PROP_ALIAS.equals(changedAttribute)) {
                     if (enableOptimizeAliasResolution) {
                         doRemoveAlias(path, false);
@@ -303,6 +309,9 @@ public class MapEntries implements Event
                     doRemoveVanity(path);
                 } else if (PROP_VANITY_ORDER.equals(changedAttribute)) {
                     doUpdateVanityOrder(path, true);
+                } else if (PROP_REDIRECT_EXTERNAL.equals(changedAttribute)
+                        || 
PROP_REDIRECT_EXTERNAL_REDIRECT_STATUS.equals(changedAttribute)) {
+                    doUpdateRedirectStatus(path);
                 } else if 
(ResourceResolverImpl.PROP_ALIAS.equals(changedAttribute)) {
                     if (enableOptimizeAliasResolution) {
                         doRemoveAlias(path, nodeDeletion); 
@@ -414,6 +423,14 @@ public class MapEntries implements Event
             }
         }
     }
+    
+    private void doUpdateRedirectStatus(String path) {
+        String actualContentPath = getActualContentPath(path);
+        List<String> vanityPaths = vanityTargets.get(actualContentPath);
+        if (vanityPaths != null) {
+            doUpdateVanity(path);
+        }
+    }
 
     private void doAddAlias(String path) {
         Resource resource = resolver.getResource(path);
@@ -653,8 +670,7 @@ public class MapEntries implements Event
                 if (log.isDebugEnabled()) {
                     log.debug("found removed attributes {}", 
removedAttributes);
                 }
-                final String checkPath = getActualContentPath(path);
-                wasResolverRefreshed = doRemoveAttributes(checkPath, 
removedAttributes, false, wasResolverRefreshed);
+                wasResolverRefreshed = doRemoveAttributes(path, 
removedAttributes, false, wasResolverRefreshed);
             } 
         }
     }
@@ -942,7 +958,7 @@ public class MapEntries implements Event
                 // whether the target is attained by a external redirect or
                 // by an internal redirect is defined by the sling:redirect
                 // property
-                final int status = props.get("sling:redirect", false) ? 
props.get(
+                final int status = props.get(PROP_REDIRECT_EXTERNAL, false) ? 
props.get(
                         PROP_REDIRECT_EXTERNAL_REDIRECT_STATUS, 
factory.getDefaultVanityPathRedirectStatus())
                         : -1;
 


Reply via email to