in src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntries.java [553:608]
private void gather(
final List<MapEntry> entries,
final Map<String, MapEntry> mapEntries,
final Resource parent,
final String parentPath) {
// scheme list
final Iterator<Resource> children = parent.listChildren();
while (children.hasNext()) {
final Resource child = children.next();
final ValueMap vm = ResourceUtil.getValueMap(child);
String name = vm.get(PROP_REG_EXP, String.class);
boolean trailingSlash = false;
if (name == null) {
name = child.getName().concat("/");
trailingSlash = true;
}
// Check for placeholders and replace if needed
name = stringInterpolationProvider.substitute(name);
final String childPath = parentPath.concat(name);
// gather the children of this entry (only if child is not end
// hooked)
if (!childPath.endsWith("$")) {
// add trailing slash to child path to append the child
String childParent = childPath;
if (!trailingSlash) {
childParent = childParent.concat("/");
}
gather(entries, mapEntries, child, childParent);
}
// add resolution entries for this node
MapEntry childResolveEntry = null;
try {
childResolveEntry = MapEntry.createResolveEntry(childPath, child, trailingSlash);
} catch (IllegalArgumentException iae) {
// ignore this entry
log.debug("ignored entry due exception ", iae);
}
if (childResolveEntry != null) {
entries.add(childResolveEntry);
}
// add map entries for this node
final List<MapEntry> childMapEntries = MapEntry.createMapEntry(childPath, child, trailingSlash);
if (childMapEntries != null) {
for (final MapEntry mapEntry : childMapEntries) {
addMapEntry(mapEntries, mapEntry.getPattern(), mapEntry.getRedirect()[0], mapEntry.getStatus());
}
}
}
}