incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1458452 - /sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java
Date Tue, 19 Mar 2013 18:32:58 GMT
Author: cziegeler
Date: Tue Mar 19 18:32:58 2013
New Revision: 1458452

URL: http://svn.apache.org/r1458452
Log:
SLING-2780 :  Make ResourceMetadata read-only when delivered to client code 

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

Modified: sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java?rev=1458452&r1=1458451&r2=1458452&view=diff
==============================================================================
--- sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java
(original)
+++ sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java
Tue Mar 19 18:32:58 2013
@@ -863,7 +863,13 @@ public class ResourceResolverImpl extend
     }
 
     private Resource getChildInternal(final Resource parent, final String childName) {
-        Resource child = getResource(parent, childName);
+        final String path;
+        if ( childName.startsWith("/") ) {
+            path = childName;
+        } else {
+            path = parent.getPath() + '/' + childName;
+        }
+        Resource child = getResourceInternal(path);
         if (child != null) {
             final String alias = getProperty(child, PROP_REDIRECT_INTERNAL);
             if (alias != null) {
@@ -881,8 +887,15 @@ public class ResourceResolverImpl extend
 
         final Map<String, String> aliases = factory.getMapEntries().getAliasMap(parent.getPath());
         if (aliases != null) {
-            if (aliases.containsKey(childName)) {
-                final Resource aliasedChild = getResource(parent, aliases.get(childName));
+            final String aliasName = aliases.get(childName);
+            if (aliasName != null ) {
+                final String aliasPath;
+                if ( aliasName.startsWith("/") ) {
+                    aliasPath = aliasName;
+                } else {
+                    aliasPath = parent.getPath() + '/' + aliasName;
+                }
+                final Resource aliasedChild = getResourceInternal(aliasPath);
                 logger.debug("getChildInternal: Found Resource {} with alias {} to use",
aliasedChild, childName);
                 return aliasedChild;
             }



Mime
View raw message