You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by fm...@apache.org on 2008/11/26 09:12:55 UTC

svn commit: r720763 - /incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver2.java

Author: fmeschbe
Date: Wed Nov 26 00:12:55 2008
New Revision: 720763

URL: http://svn.apache.org/viewvc?rev=720763&view=rev
Log:
SLING-249 Wrong property names defined in the constants and
add support to set the sling:alias property on jcr:content
child node

Modified:
    incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver2.java

Modified: incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver2.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver2.java?rev=720763&r1=720762&r2=720763&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver2.java (original)
+++ incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver2.java Wed Nov 26 00:12:55 2008
@@ -59,9 +59,9 @@
 
     private static final String MAP_ROOT = "/etc/map";
 
-    public static final String PROP_REG_EXP = "sling:regexp";
+    public static final String PROP_REG_EXP = "sling:match";
 
-    public static final String PROP_REDIRECT_INTERNAL = "sling:alias";
+    public static final String PROP_REDIRECT_INTERNAL = "sling:internalRedirect";
 
     public static final String PROP_ALIAS = "sling:alias";
 
@@ -518,9 +518,20 @@
     }
 
     private String getProperty(Resource res, String propName) {
+        
+        // check the property in the resource itself
         ValueMap props = res.adaptTo(ValueMap.class);
         if (props != null) {
-            return props.get(propName, String.class);
+            String prop = props.get(propName, String.class);
+            if (prop != null) {
+                return prop;
+            }
+        }
+        
+        // otherwise, check it in the jcr:content child resource
+        res = getResource(res, "jcr:content");
+        if (res != null) {
+            return getProperty(res, propName);
         }
 
         return null;