You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ra...@apache.org on 2020/04/24 14:49:49 UTC
[sling-org-apache-sling-scripting-bundle-tracker] branch master
updated: SLING-9159 - Switch to the LazyBindings implementation from
org.apache.sling.api
This is an automated email from the ASF dual-hosted git repository.
radu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-bundle-tracker.git
The following commit(s) were added to refs/heads/master by this push:
new 5b16579 SLING-9159 - Switch to the LazyBindings implementation from org.apache.sling.api
5b16579 is described below
commit 5b165791dd28e8a02595e39160e9c652687d29f5
Author: Radu Cotescu <ra...@apache.org>
AuthorDate: Fri Apr 24 16:48:46 2020 +0200
SLING-9159 - Switch to the LazyBindings implementation from org.apache.sling.api
* switched to LazyBindings in all classes
---
.../scripting/bundle/tracker/internal/BundledScriptContext.java | 8 ++++----
.../scripting/bundle/tracker/internal/ScriptContextProvider.java | 3 +--
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/BundledScriptContext.java b/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/BundledScriptContext.java
index 311eeae..43c5fde 100644
--- a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/BundledScriptContext.java
+++ b/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/BundledScriptContext.java
@@ -24,18 +24,18 @@ import java.util.Arrays;
import java.util.List;
import javax.script.Bindings;
-import javax.script.SimpleBindings;
import javax.script.SimpleScriptContext;
+import org.apache.sling.api.scripting.LazyBindings;
import org.apache.sling.api.scripting.SlingScriptConstants;
class BundledScriptContext extends SimpleScriptContext {
private static final Integer[] SCOPES = {SlingScriptConstants.SLING_SCOPE, GLOBAL_SCOPE, ENGINE_SCOPE};
- private Bindings globalScope = new SimpleBindings();
- private Bindings engineScope = new SimpleBindings();
- private Bindings slingScope = new SimpleBindings();
+ private Bindings globalScope = new LazyBindings();
+ private Bindings engineScope = new LazyBindings();
+ private Bindings slingScope = new LazyBindings();
@Override
public void setBindings(final Bindings bindings, final int scope) {
diff --git a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/ScriptContextProvider.java b/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/ScriptContextProvider.java
index 5607669..caee87e 100644
--- a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/ScriptContextProvider.java
+++ b/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/ScriptContextProvider.java
@@ -31,7 +31,6 @@ import javax.script.ScriptContext;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
-import javax.script.SimpleBindings;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
@@ -83,7 +82,7 @@ public class ScriptContextProvider {
executable.getScriptEngineName(), executable.getPath()));
}
// prepare the SlingBindings
- Bindings bindings = new SimpleBindings();
+ Bindings bindings = new LazyBindings();
bindings.put("properties", request.getResource().getValueMap());
bindings.put(SlingBindings.REQUEST, request);
bindings.put(SlingBindings.RESPONSE, response);