in src/main/java/org/apache/sling/superimposing/impl/SuperimposingResourceProviderImpl.java [136:152]
static String mapPathWithOverlay(SuperimposingResourceProviderImpl provider, ResourceResolver resolver, String path) {
if (StringUtils.equals(path, provider.rootPath)) {
// Superimposing root path cannot be overlayed
return mapPathWithoutOverlay(provider, resolver, path);
}
else if (StringUtils.startsWith(path, provider.rootPrefix)) {
if (hasOverlayResource(resolver, path)) {
// overlay item exists, allow underlying resource provider to step in
return null;
}
else {
// overlay item does not exist, overlay cannot be applied, fallback to mapped path without overlay
return mapPathWithoutOverlay(provider, resolver, path);
}
}
return null;
}