You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:01:01 UTC

[sling-org-apache-sling-resourceresolver] 17/24: SLING-2780 : Make ResourceMetadata read-only when delivered to client code

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.resourceresolver-1.0.6
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git

commit b44b90795a3c8f280fed98325d02c7b67d048203
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Mar 19 18:32:58 2013 +0000

    SLING-2780 :  Make ResourceMetadata read-only when delivered to client code
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/resourceresolver@1458452 13f79535-47bb-0310-9956-ffa450edef68
---
 .../resourceresolver/impl/ResourceResolverImpl.java   | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java b/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java
index e965941..8b82e34 100644
--- a/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java
+++ b/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java
@@ -863,7 +863,13 @@ public class ResourceResolverImpl extends SlingAdaptable implements ResourceReso
     }
 
     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 extends SlingAdaptable implements ResourceReso
 
         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;
             }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.