You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by pa...@apache.org on 2020/05/10 23:05:31 UTC
[sling-org-apache-sling-scripting-sightly-js-provider] 01/01:
SLING-9406 - Add bundled script support to the servlets resolver
This is an automated email from the ASF dual-hosted git repository.
pauls pushed a commit to branch issues/SLING-9406
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-sightly-js-provider.git
commit a284bce78ded3803214b824d3b85a9b461c30f11
Author: Karl Pauls <ka...@gmail.com>
AuthorDate: Mon May 11 01:05:10 2020 +0200
SLING-9406 - Add bundled script support to the servlets resolver
* look at the parent of the caller when looking up childs
---
src/main/java/org/apache/sling/scripting/sightly/js/impl/Utils.java | 3 +++
.../apache/sling/scripting/sightly/js/impl/use/DependencyResolver.java | 3 ---
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/sling/scripting/sightly/js/impl/Utils.java b/src/main/java/org/apache/sling/scripting/sightly/js/impl/Utils.java
index 01d5521..17c034c 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/js/impl/Utils.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/js/impl/Utils.java
@@ -51,6 +51,9 @@ public class Utils {
public static Resource getScriptResource(Resource caller, String path, Bindings bindings) {
Resource scriptResource = caller.getChild(path);
if (scriptResource == null) {
+ scriptResource = caller.getParent().getChild(path);
+ }
+ if (scriptResource == null) {
Resource componentCaller = ResourceResolution
.getResourceForRequest(caller.getResourceResolver(), (SlingHttpServletRequest) bindings.get(SlingBindings.REQUEST));
if (isResourceOverlay(caller, componentCaller)) {
diff --git a/src/main/java/org/apache/sling/scripting/sightly/js/impl/use/DependencyResolver.java b/src/main/java/org/apache/sling/scripting/sightly/js/impl/use/DependencyResolver.java
index 44fc612..4db41ae 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/js/impl/use/DependencyResolver.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/js/impl/use/DependencyResolver.java
@@ -91,9 +91,6 @@ public class DependencyResolver {
if (resource != null) {
String type = resource.getResourceType();
caller = scriptingResourceResolver.getResource(type);
- if (caller != null) {
- scriptResource = Utils.getScriptResource(caller, dependency, bindings);
- }
}
}
if (caller != null) {