Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
String path = ...; // the absolute path
Resource current = getResource("/");
String[] segements = path.split("/");
for (String segment: segments) {
    Resource child = getResource(current, segement);
    if (child == null) {
        Iterator<Resource> children = listChildren(current);
        current = null;
        while (children.hasNext()) {
            child = children.next();
            if (segment.equals(getSlingAlias(child))) {
                current = child;
                break;
            }
        }
        if (current == null) {
            // fail
            break;
        }
    } else {
        current = child;
    }
}

Current Status

In Revision 720647 of Sling trunk I have implemented a first shot at a new JCR resource resolver. This resource resolver currently lives side-by-side with the old one and the JcrResourceResolverFactoryImpl decides based on configuration (Configuration Admin configuration or framework property of the name resource.resolver.new) whether the new or the old resource resolver is to be used. The default is to use the new resource resolver.

The new resource resolver currently has the following setup:

  • All configuration except the search path is ignored.
  • Mappings are read from /etc/map as described above. There are no default settings for now.
  • Existing sling:vanityPath settings are loaded as map entries where the sling:vanityPath property defines the regular expression (using the fixed string ./. to indicate that the entry applies for any scheme and any host.port. The path of the node having the sling:vanityPath property is used as the redirect path. Finally the sling:redirect property of the node is used to decided whether the redirect is internal (property is false or missing) or external (property is set to true).