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-servlets-resolver.git


The following commit(s) were added to refs/heads/issues/SLING-9406 by this push:
     new d4006e0  SLING-9406: Add bundled script support to the servlets 
resolver
d4006e0 is described below

commit d4006e0910b2804a7b63e67df67474823123e9fd
Author: Karl Pauls <[email protected]>
AuthorDate: Wed Apr 29 21:46:15 2020 +0200

    SLING-9406: Add bundled script support to the servlets resolver
---
 pom.xml                                            |  47 ++---
 .../bundle/tracker/BundledRenderUnit.java          | 104 -----------
 .../internal/AbstractBundledRenderUnit.java        | 158 ----------------
 .../tracker/internal/BundledScriptContext.java     | 174 -----------------
 .../tracker/internal/BundledScriptFinder.java      | 132 -------------
 .../bundle/tracker/internal/LogWriter.java         | 126 -------------
 .../bundle/tracker/internal/PrecompiledScript.java |  75 --------
 .../bundle/tracker/internal/ProtectedBindings.java | 147 ---------------
 .../scripting/bundle/tracker/internal/Script.java  | 101 ----------
 .../tracker/internal/ScriptContextProvider.java    | 146 ---------------
 .../tracker/internal/request/OnDemandReader.java   |  97 ----------
 .../tracker/internal/request/OnDemandWriter.java   | 103 -----------
 .../tracker/internal/request/ResponseWrapper.java  |  50 -----
 .../tracker/BundledRenderUnitCapability.java       |   2 +-
 .../bundle/tracker/BundledScriptFinder.java}       |  16 +-
 .../resolver/bundle/tracker}/Executable.java       |  32 +---
 .../resolver}/bundle/tracker/ResourceType.java     |   2 +-
 .../resolver}/bundle/tracker/TypeProvider.java     |   2 +-
 .../bundle/tracker/internal/BundledHooks.java      |   2 +-
 .../internal/BundledRenderUnitCapabilityImpl.java  |   6 +-
 .../tracker/internal/BundledScriptServlet.java     |  27 +--
 .../tracker/internal/BundledScriptTracker.java     |  20 +-
 .../bundle/tracker/internal/TypeProviderImpl.java  |   8 +-
 .../tracker/internal/request/RequestWrapper.java   |  15 +-
 .../resolver}/bundle/tracker/package-info.java     |   2 +-
 .../servlets/resolver/internal/ResolverConfig.java |   2 +-
 .../resolver/internal/resource/ServletMounter.java |   3 +-
 .../tracker/internal/BundledScriptContextTest.java | 151 ---------------
 .../bundle/tracker/internal/LogWriterTest.java     |  60 ------
 .../tracker/internal/ProtectedBindingsTest.java    | 205 ---------------------
 .../resolver}/bundle/tracker/ResourceTypeTest.java |   2 +-
 .../bundle/tracker/internal/BundledHooksTest.java  |   2 +-
 .../tracker/internal/BundledScriptTrackerTest.java |   2 +-
 .../resolver/it/ServletResolverTestSupport.java    |   2 -
 34 files changed, 76 insertions(+), 1947 deletions(-)

diff --git a/pom.xml b/pom.xml
index b7c2e68..424326a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -257,6 +257,21 @@
             <artifactId>slf4j-api</artifactId>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>org.jetbrains</groupId>
+            <artifactId>annotations</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.annotation.bundle</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>osgi.cmpn</artifactId>
+            <scope>provided</scope>
+        </dependency>
         <!-- Testing -->
         <dependency>
             <groupId>org.apache.sling</groupId>
@@ -285,11 +300,6 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.jetbrains</groupId>
-            <artifactId>annotations</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
             <groupId>org.ops4j.pax.exam</groupId>
             <artifactId>pax-exam</artifactId>
             <version>${org.ops4j.pax.exam.version}</version>
@@ -344,36 +354,11 @@
             <version>1.6.16</version>
             <scope>test</scope>
         </dependency>
-
-        <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.scripting.api</artifactId>
-            <version>2.2.0</version>
-            <scope>provided</scope>
-        </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.scripting.core</artifactId>
             <version>2.2.0</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.commons.compiler</artifactId>
-            <version>2.3.7-SNAPSHOT</version>
-            <scope>provided</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.annotation.bundle</artifactId>
-            <scope>provided</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
-            <scope>provided</scope>
+            <scope>test</scope>
         </dependency>
     </dependencies>
 
diff --git 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/BundledRenderUnit.java
 
b/src/main/java/org/apache/sling/scripting/bundle/tracker/BundledRenderUnit.java
deleted file mode 100644
index 3849a36..0000000
--- 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/BundledRenderUnit.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements.  See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership.  The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License.  You may obtain a copy of the License at
- ~
- ~   http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied.  See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker;
-
-import java.util.Set;
-
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.osgi.annotation.versioning.ProviderType;
-import org.osgi.framework.Bundle;
-
-/**
- * <p>
- * A {@code BundledRenderUnit} represents a pre-packaged script or precompiled 
script that will be executed in order to render a
- * {@link org.apache.sling.api.SlingHttpServletRequest}.
- * </p>
- * <p>
- * If the current {@link org.apache.sling.api.SlingHttpServletRequest} is 
served by a {@code BundledRenderUnit}, the
- * {@code org.apache.sling.scripting.bundle.tracker} will set the {@code 
BundledRenderUnit} in the {@link javax.script.Bindings} map associated to the 
request,
- * under the {@link #VARIABLE} key.
- * </p>
- */
-@ProviderType
-public interface BundledRenderUnit {
-
-    /**
-     * The variable available in the {@link javax.script.Bindings} associated 
to a {@link org.apache.sling.api.SlingHttpServletRequest}
-     * if that request is served by a {@code BundledRenderUnit}.
-     */
-    String VARIABLE = BundledRenderUnit.class.getName();
-
-    /**
-     * In case this {@code BundledRenderUnit} wraps a precompiled script, this 
method will return an instance of that object.
-     *
-     * @return a precompiled unit, if {@code this} unit wraps a precompiled 
script; {@code null} otherwise
-     */
-    @Nullable
-    default Object getUnit() {
-        return null;
-    }
-
-    /**
-     * Returns the name of {@code this BundledRenderUnit}. This can be the 
name of the wrapped script or precompiled script.
-     *
-     * @return the name {@code this BundledRenderUnit}
-     */
-    @NotNull String getName();
-
-    /**
-     * Returns the {@link Bundle} in which the script or precompiled script is 
packaged. This method can be useful for getting an
-     * instance of the bundle's classloader, when needed to load dependencies 
at run time. To do so the following code example can help:
-     *
-     * <pre>
-     * Bundle bundle = bundledRenderUnit.getBundle();
-     * Classloader bundleClassloader = 
bundle.adapt(BundleWiring.class).getClassLoader();
-     * </pre>
-     */
-    @NotNull Bundle getBundle();
-
-    /**
-     * Returns the {@code Set} of {@link TypeProvider}s which are related to 
this unit.
-     *
-     * @return the set of providers; if the unit doesn't have any inheritance 
chains, then the set will contain only one {@link
-     * TypeProvider}
-     */
-    @NotNull Set<TypeProvider> getTypeProviders();
-
-    /**
-     * Retrieves an OSGi runtime dependency of the wrapped script identified 
by the passed {@code className} parameter.
-     *
-     * @param className the fully qualified class name
-     * @param <T>       the expected service type
-     * @return an instance of the {@link T} or {@code null}
-     */
-    @Nullable <T> T getService(@NotNull String className);
-
-    /**
-     * Retrieves multiple instances of an OSGi runtime dependency of the 
wrapped script identified by the passed {@code className}
-     * parameter, filtered according to the passed {@code filter}.
-     *
-     * @param className the fully qualified class name
-     * @param filter    a filter expression or {@code null} if all the 
instances should be returned; for more details about the {@code
-     *                  filter}'s syntax check {@link 
org.osgi.framework.BundleContext#getServiceReferences(String, String)}
-     * @param <T>       the expected service type
-     * @return an instance of the {@link T} or {@code null}
-     */
-    @Nullable <T> T[] getServices(@NotNull String className, @Nullable String 
filter);
-}
diff --git 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/AbstractBundledRenderUnit.java
 
b/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/AbstractBundledRenderUnit.java
deleted file mode 100644
index 9362b32..0000000
--- 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/AbstractBundledRenderUnit.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements.  See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership.  The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License.  You may obtain a copy of the License at
- ~
- ~   http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied.  See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker.internal;
-
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.sling.scripting.bundle.tracker.TypeProvider;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-abstract class AbstractBundledRenderUnit implements Executable {
-
-    private static final Logger LOG = 
LoggerFactory.getLogger(AbstractBundledRenderUnit.class.getName());
-
-    private final Set<TypeProvider> providers;
-    private final Bundle bundle;
-    private final BundleContext bundleContext;
-    private final String path;
-    private final String scriptEngineName;
-    private List<ServiceReference<?>> references;
-    private Map<String, Object> services;
-
-
-    AbstractBundledRenderUnit(@NotNull Set<TypeProvider> providers, @NotNull 
Bundle bundle, @NotNull String path,
-                              @NotNull String scriptEngineName) {
-        this.providers = providers;
-        this.bundle = bundle;
-        this.path = path;
-        this.scriptEngineName = scriptEngineName;
-        bundleContext = bundle.getBundleContext();
-    }
-
-    @Override
-    @NotNull
-    public Bundle getBundle() {
-        return bundle;
-    }
-
-    @Override
-    public @NotNull Set<TypeProvider> getTypeProviders() {
-        return providers;
-    }
-
-    @Override
-    public @NotNull String getPath() {
-        return path;
-    }
-
-    @Override
-    public @NotNull String getScriptEngineName() {
-        return scriptEngineName;
-    }
-
-    @Override
-    @Nullable
-    @SuppressWarnings("unchecked")
-    public <T> T getService(@NotNull String className) {
-        LOG.debug("Attempting to load class {} as an OSGi service.", 
className);
-        T result = (this.services == null ? null : (T) 
this.services.get(className));
-        if (result == null) {
-            final ServiceReference<?> ref = 
this.bundleContext.getServiceReference(className);
-            if (ref != null) {
-                result = (T) this.bundleContext.getService(ref);
-                if (result != null) {
-                    if (this.services == null) {
-                        this.services = new HashMap<>();
-                    }
-                    if (this.references == null) {
-                        this.references = new ArrayList<>();
-                    }
-                    this.references.add(ref);
-                    this.services.put(className, result);
-                    return result;
-                }
-            }
-        }
-        return null;
-    }
-
-    @Override
-    @Nullable
-    @SuppressWarnings("unchecked")
-    public <T> T[] getServices(@NotNull String className, @Nullable String 
filter) {
-        T[] result = null;
-        try {
-            final ServiceReference<?>[] refs = 
this.bundleContext.getServiceReferences(className, filter);
-
-            if (refs != null) {
-                // sort by service ranking (lowest first) (see 
ServiceReference#compareTo(Object))
-                List<ServiceReference<?>> localReferences = 
Arrays.asList(refs);
-                Collections.sort(localReferences);
-                // get the highest ranking first
-                Collections.reverse(localReferences);
-
-                final List<T> objects = new ArrayList<>();
-                for (ServiceReference<?> reference : localReferences) {
-                    final T service = (T) 
this.bundleContext.getService(reference);
-                    if (service != null) {
-                        if (this.references == null) {
-                            this.references = new ArrayList<>();
-                        }
-                        this.references.add(reference);
-                        objects.add(service);
-                    }
-                }
-                if (!objects.isEmpty()) {
-                    T[] srv = (T[]) 
Array.newInstance(bundle.loadClass(className), objects.size());
-                    result = objects.toArray(srv);
-                }
-            }
-        } catch (Exception e) {
-            LOG.error(String.format("Unable to retrieve the services of type 
%s.", className), e);
-        }
-        return result;
-    }
-
-    @Override
-    public void releaseDependencies() {
-        if (references != null) {
-            for (ServiceReference<?> reference : this.references) {
-                bundleContext.ungetService(reference);
-            }
-            references.clear();
-        }
-        if (services != null) {
-            services.clear();
-        }
-    }
-
-}
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
deleted file mode 100644
index 43c5fde..0000000
--- 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/BundledScriptContext.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements.  See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership.  The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License.  You may obtain a copy of the License at
- ~
- ~   http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied.  See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker.internal;
-
-import java.io.Reader;
-import java.io.Writer;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.script.Bindings;
-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 LazyBindings();
-    private Bindings engineScope = new LazyBindings();
-    private Bindings slingScope = new LazyBindings();
-
-    @Override
-    public void setBindings(final Bindings bindings, final int scope) {
-        if (bindings == null) {
-            throw new NullPointerException("None of the ScriptContext scopes 
accepts null bindings.");
-        }
-        switch (scope) {
-            case SlingScriptConstants.SLING_SCOPE:
-                this.slingScope = bindings;
-                break;
-            case 100:
-                this.engineScope = bindings;
-                break;
-            case 200:
-                this.globalScope = bindings;
-                break;
-            default:
-                throw new IllegalArgumentException("Invalid scope.");
-        }
-    }
-
-    @Override
-    public Bindings getBindings(final int scope) {
-        switch (scope) {
-            case SlingScriptConstants.SLING_SCOPE:
-                return slingScope;
-            case 100:
-                return this.engineScope;
-            case 200:
-                return this.globalScope;
-        }
-        throw new IllegalArgumentException("Invalid scope.");
-    }
-
-    @Override
-    public void setAttribute(final String name, final Object value, final int 
scope) {
-        if (name == null) {
-            throw new IllegalArgumentException("Name is null.");
-        }
-        final Bindings bindings = getBindings(scope);
-        if (bindings != null) {
-            bindings.put(name, value);
-        }
-    }
-
-    @Override
-    public Object getAttribute(String name) {
-        if (name == null) {
-            throw new IllegalArgumentException("Name is null");
-        }
-        for (final int scope : SCOPES) {
-            final Bindings bindings = getBindings(scope);
-            if (bindings != null) {
-                final Object o = bindings.get(name);
-                if (o != null) {
-                    return o;
-                }
-            }
-        }
-        return null;
-    }
-
-    @Override
-    public Object getAttribute(final String name, final int scope) {
-        if (name == null) {
-            throw new IllegalArgumentException("Name is null.");
-        }
-        final Bindings bindings = getBindings(scope);
-        if (bindings != null) {
-            return bindings.get(name);
-        }
-        return null;
-    }
-
-    @Override
-    public Object removeAttribute(final String name, final int scope) {
-        if (name == null) {
-            throw new IllegalArgumentException("Name is null.");
-        }
-        final Bindings bindings = getBindings(scope);
-        if (bindings != null) {
-            return bindings.remove(name);
-        }
-        return null;
-    }
-
-    @Override
-    public int getAttributesScope(String name) {
-        if (name == null) {
-            throw new IllegalArgumentException("Name is null.");
-        }
-        for (final int scope : SCOPES) {
-            if ((getBindings(scope) != null) && 
(getBindings(scope).containsKey(name))) {
-                return scope;
-            }
-        }
-        return -1;
-    }
-
-    @Override
-    public List<Integer> getScopes() {
-        return Arrays.asList(SCOPES);
-    }
-
-    @Override
-    public Writer getWriter() {
-        return writer;
-    }
-
-    @Override
-    public Writer getErrorWriter() {
-        return errorWriter;
-    }
-
-    @Override
-    public void setWriter(Writer writer) {
-        this.writer = writer;
-    }
-
-    @Override
-    public void setErrorWriter(Writer writer) {
-        this.errorWriter = writer;
-    }
-
-    @Override
-    public Reader getReader() {
-        return reader;
-    }
-
-    @Override
-    public void setReader(Reader reader) {
-        this.reader = reader;
-    }
-
-
-}
diff --git 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/BundledScriptFinder.java
 
b/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/BundledScriptFinder.java
deleted file mode 100644
index f4f44e2..0000000
--- 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/BundledScriptFinder.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements.  See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership.  The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License.  You may obtain a copy of the License at
- ~
- ~   http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied.  See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker.internal;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.sling.commons.compiler.source.JavaEscapeHelper;
-import org.apache.sling.scripting.bundle.tracker.BundledRenderUnitCapability;
-import org.apache.sling.scripting.bundle.tracker.ResourceType;
-import org.apache.sling.scripting.bundle.tracker.TypeProvider;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.osgi.framework.Bundle;
-import org.osgi.service.component.annotations.Component;
-
-@Component(
-        service = BundledScriptFinder.class
-)
-public class BundledScriptFinder {
-
-    private static final String NS_JAVAX_SCRIPT_CAPABILITY = "javax.script";
-    private static final String SLASH = "/";
-    private static final String DOT = ".";
-
-    Executable getScript(Set<TypeProvider> providers, Set<TypeProvider> 
allProviders) {
-        for (TypeProvider provider : providers) {
-            BundledRenderUnitCapability capability = 
provider.getBundledRenderUnitCapability();
-            for (String match : 
buildScriptMatches(capability.getResourceTypes(),
-                    capability.getSelectors().toArray(new String[0]), 
capability.getMethod(), capability.getExtension())) {
-                String scriptExtension = capability.getScriptExtension();
-                String scriptEngineName = capability.getScriptEngineName();
-                if (StringUtils.isNotEmpty(scriptExtension) && 
StringUtils.isNotEmpty(scriptEngineName)) {
-                    Executable executable = 
getExecutable(provider.getBundle(), match, scriptEngineName, scriptExtension, 
allProviders);
-                    if (executable != null) {
-                        return executable;
-                    }
-                }
-            }
-        }
-        return null;
-    }
-
-    Executable getScript(@NotNull Bundle bundle, @NotNull String path, 
@NotNull String scriptEngineName,
-                         @NotNull Set<TypeProvider> providers) {
-        String className = JavaEscapeHelper.makeJavaPackage(path);
-        try {
-            Class<?> clazz = bundle.loadClass(className);
-            return new PrecompiledScript(providers, bundle, path, clazz, 
scriptEngineName);
-        } catch (ClassNotFoundException ignored) {
-            URL bundledScriptURL = bundle.getEntry(NS_JAVAX_SCRIPT_CAPABILITY 
+ (path.startsWith("/") ? "" : SLASH) + path);
-            if (bundledScriptURL != null) {
-                return new Script(providers, bundle, path, bundledScriptURL, 
scriptEngineName);
-            }    // do nothing here
-        }
-
-        return null;
-    }
-
-    @Nullable
-    private Executable getExecutable(@NotNull Bundle bundle, @NotNull String 
match, @NotNull String scriptEngineName,
-                                     @NotNull String scriptExtension, @NotNull 
Set<TypeProvider> providers) {
-        String path = match + DOT + scriptExtension;
-        return getScript(bundle, path, scriptEngineName, providers);
-    }
-
-    private List<String> buildScriptMatches(Set<ResourceType> resourceTypes, 
String[] selectors, String method, String extension) {
-        List<String> matches = new ArrayList<>();
-        for (ResourceType resourceType : resourceTypes) {
-            if (selectors.length > 0) {
-                for (int i = selectors.length - 1; i >= 0; i--) {
-                    String base =
-                            resourceType.getType() +
-                                    
(StringUtils.isNotEmpty(resourceType.getVersion()) ? SLASH + 
resourceType.getVersion() + SLASH :
-                                            SLASH) +
-                                    String.join(SLASH, 
Arrays.copyOf(selectors, i + 1));
-                    if (StringUtils.isNotEmpty(extension)) {
-                        if (StringUtils.isNotEmpty(method)) {
-                            matches.add(base + DOT + extension + DOT + method);
-                        }
-                        matches.add(base + DOT + extension);
-                    }
-                    if (StringUtils.isNotEmpty(method)) {
-                        matches.add(base + DOT + method);
-                    }
-                    matches.add(base);
-                }
-            }
-            String base = resourceType.getType() +
-                    (StringUtils.isNotEmpty(resourceType.getVersion()) ? SLASH 
+ resourceType.getVersion() : StringUtils.EMPTY);
-
-            if (StringUtils.isNotEmpty(extension)) {
-                if (StringUtils.isNotEmpty(method)) {
-                    matches.add(base + SLASH + resourceType.getResourceLabel() 
+ DOT + extension + DOT + method);
-                }
-                matches.add(base + SLASH + resourceType.getResourceLabel() + 
DOT + extension);
-            }
-            if (StringUtils.isNotEmpty(method)) {
-                matches.add(base + SLASH + resourceType.getResourceLabel() + 
DOT + method);
-            }
-            matches.add(base + SLASH + resourceType.getResourceLabel());
-            if (StringUtils.isNotEmpty(method)) {
-                matches.add(base + SLASH + method);
-            }
-            if (StringUtils.isNotEmpty(extension)) {
-                matches.add(base + SLASH + extension);
-            }
-        }
-        return Collections.unmodifiableList(matches);
-    }
-}
diff --git 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/LogWriter.java
 
b/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/LogWriter.java
deleted file mode 100644
index 4988a2f..0000000
--- 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/LogWriter.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements.  See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership.  The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License.  You may obtain a copy of the License at
- ~
- ~   http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied.  See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker.internal;
-
-import java.io.Writer;
-
-import org.slf4j.Logger;
-
-class LogWriter extends Writer {
-
-    /**
-     * The logger to which the error messages are written
-     */
-    final private Logger logger;
-
-    /**
-     * The internal buffer to gather message data until being flushed or a CR 
or
-     * LF is encountered in the message data.
-     */
-    final private StringBuilder lineBuffer;
-
-    /**
-     * Creates a writer based on the given logger.
-     *
-     * @param logger the logger
-     */
-    LogWriter(Logger logger) {
-        this.logger = logger;
-        this.lineBuffer = new StringBuilder();
-    }
-
-    /**
-     * Writes the character to the internal buffer unless the character is a CR
-     * or LF in which case the buffer is written to the logger as an error
-     * message.
-     */
-    @Override
-    public void write(int c) {
-        if (c == '\n' || c == '\r') {
-            flush();
-        } else {
-            synchronized (lineBuffer) {
-                lineBuffer.append((char) c);
-            }
-        }
-    }
-
-    /**
-     * Writes the indicated characters to the internal buffer, flushing the
-     * buffer on any occurrence of a CR of LF.
-     */
-    @Override
-    public void write(char[] cbuf, int off, int len) {
-        int i = off;
-        for (int n = 0; n < len; n++, i++) {
-            char c = cbuf[i];
-
-            // if CR/LF flush the line
-            if (c == '\n' || c == '\r') {
-
-                // append upto the CR/LF
-                int subLen = i - off;
-                if (subLen > 0) {
-                    synchronized (lineBuffer) {
-                        lineBuffer.append(cbuf, off, subLen);
-                    }
-                }
-
-                // and flush
-                flush();
-
-                // new offset is after the CR/LF
-                off = i + 1;
-            }
-        }
-
-        // remaining data in the buffer is just appended
-        if (off < i) {
-            synchronized (lineBuffer) {
-                lineBuffer.append(cbuf, off, i - off);
-            }
-        }
-    }
-
-    /**
-     * Writes any data contained in the buffer to the logger as an error 
message.
-     */
-    @Override
-    public void flush() {
-
-        String message;
-        synchronized (lineBuffer) {
-            if (lineBuffer.length() == 0) {
-                return;
-            }
-            message = lineBuffer.toString();
-            lineBuffer.setLength(0);
-        }
-
-        logger.error(message);
-    }
-
-    /**
-     * Just calls {@link #flush()}
-     */
-    @Override
-    public void close() {
-        flush();
-    }
-}
diff --git 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/PrecompiledScript.java
 
b/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/PrecompiledScript.java
deleted file mode 100644
index 980c640..0000000
--- 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/PrecompiledScript.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements.  See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership.  The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License.  You may obtain a copy of the License at
- ~
- ~   http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied.  See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker.internal;
-
-import java.io.StringReader;
-import java.util.Set;
-
-import javax.script.ScriptContext;
-import javax.script.ScriptEngine;
-import javax.script.ScriptException;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.sling.scripting.bundle.tracker.TypeProvider;
-import org.jetbrains.annotations.NotNull;
-import org.osgi.framework.Bundle;
-
-class PrecompiledScript extends AbstractBundledRenderUnit {
-
-    private static final StringReader EMPTY_READER = new 
StringReader(StringUtils.EMPTY);
-    private final Class<?> clazz;
-    private volatile Object instance;
-
-    PrecompiledScript(@NotNull Set<TypeProvider> providers, @NotNull Bundle 
bundle, @NotNull String path, @NotNull Class<?> clazz,
-                      @NotNull String scriptEngineName) {
-        super(providers, bundle, path, scriptEngineName);
-        this.clazz = clazz;
-    }
-
-    @Override
-    @NotNull
-    public String getName() {
-        return clazz.getName();
-    }
-
-    @Override
-    public void eval(@NotNull ScriptEngine scriptEngine, @NotNull 
ScriptContext context) throws ScriptException {
-        scriptEngine.eval(EMPTY_READER, context);
-    }
-
-    @Override
-    public @NotNull Object getUnit() {
-        Object localInstance = instance;
-        if (localInstance == null) {
-            synchronized (this) {
-                localInstance = instance;
-                if (localInstance == null) {
-                    try {
-                        localInstance = 
clazz.getDeclaredConstructor().newInstance();
-                        instance = localInstance;
-                    } catch (Exception e) {
-                        throw new IllegalStateException("Cannot instantiate 
class " + clazz.getName(), e);
-                    }
-                }
-            }
-        }
-        return localInstance;
-    }
-
-}
diff --git 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/ProtectedBindings.java
 
b/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/ProtectedBindings.java
deleted file mode 100644
index 3376b48..0000000
--- 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/ProtectedBindings.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements.  See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership.  The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License.  You may obtain a copy of the License at
- ~
- ~   http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied.  See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker.internal;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Set;
-
-import javax.script.Bindings;
-
-class ProtectedBindings implements Bindings {
-
-    private final Bindings wrapped;
-    private final Set<String> protectedKeys;
-
-    ProtectedBindings(Bindings wrapped, Set<String> protectedKeys) {
-        this.wrapped = wrapped;
-        this.protectedKeys = protectedKeys;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @throws IllegalArgumentException if the key is protected
-     */
-    public Object put(String key, Object value) {
-        if (protectedKeys.contains(key)) {
-            throw new IllegalArgumentException(String.format("Key %s is 
protected.", key));
-        }
-        return wrapped.put(key, value);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void putAll(Map<? extends String, ?> toMerge) {
-        for (Map.Entry<? extends String, ?> entry : toMerge.entrySet()) {
-            if (!protectedKeys.contains(entry.getKey())) {
-                wrapped.put(entry.getKey(), entry.getValue());
-            } else {
-                throw new IllegalArgumentException(String.format("Key %s is 
protected.", entry.getKey()));
-            }
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @throws IllegalArgumentException if the key is protected
-     */
-    public Object remove(Object key) {
-        if (protectedKeys.contains(key)) {
-            throw new IllegalArgumentException(String.format("Key %s is 
protected.", key));
-        }
-        return wrapped.remove(key);
-    }
-
-    /**
-     * The clear operation is not supported.
-     */
-    public void clear() {
-        throw new UnsupportedOperationException("ProtectedBindings does not 
support clear()");
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean containsValue(Object value) {
-        return wrapped.containsValue(value);
-    }
-
-    /**
-     * Returns a Set view of the mappings contains in this map. The Set is
-     * unmodifiable.
-     *
-     * @return an unmodifiable Set view of the map
-     */
-    public Set<Entry<String, Object>> entrySet() {
-        return Collections.unmodifiableSet(wrapped.entrySet());
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean isEmpty() {
-        return wrapped.isEmpty();
-    }
-
-    /**
-     * Returns a Set view of the keys contained in this map. The Set is
-     * unmodifiable.
-     *
-     * @return an unmodifiable Set view of the map's keys
-     */
-    public Set<String> keySet() {
-        return Collections.unmodifiableSet(wrapped.keySet());
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public int size() {
-        return wrapped.size();
-    }
-
-    /**
-     * Returns a Collection view of the values contained in this map. The
-     * Collection is unmodifiable.
-     *
-     * @return an unmodifiable Collection view of the map's values
-     */
-    public Collection<Object> values() {
-        return Collections.unmodifiableCollection(wrapped.values());
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean containsKey(Object key) {
-        return wrapped.containsKey(key);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Object get(Object key) {
-        return wrapped.get(key);
-    }
-
-}
diff --git 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/Script.java 
b/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/Script.java
deleted file mode 100644
index bd274b3..0000000
--- 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/Script.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements.  See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership.  The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License.  You may obtain a copy of the License at
- ~
- ~   http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied.  See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker.internal;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.net.URL;
-import java.nio.charset.StandardCharsets;
-import java.util.Set;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-import javax.script.Compilable;
-import javax.script.CompiledScript;
-import javax.script.ScriptContext;
-import javax.script.ScriptEngine;
-import javax.script.ScriptException;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.sling.scripting.bundle.tracker.TypeProvider;
-import org.apache.sling.scripting.core.ScriptNameAwareReader;
-import org.jetbrains.annotations.NotNull;
-import org.osgi.framework.Bundle;
-
-class Script extends AbstractBundledRenderUnit {
-
-    private final URL url;
-    private String sourceCode;
-    private CompiledScript compiledScript = null;
-    private Lock compilationLock = new ReentrantLock();
-    private Lock readLock = new ReentrantLock();
-
-
-    Script(@NotNull Set<TypeProvider> providers, @NotNull Bundle bundle, 
@NotNull String path, @NotNull URL url,
-           @NotNull String scriptEngineName) {
-        super(providers, bundle, path, scriptEngineName);
-        this.url = url;
-    }
-
-    private String getSourceCode() throws IOException {
-        if (sourceCode == null) {
-            readLock.lock();
-            try {
-                if (sourceCode == null) {
-                    sourceCode = IOUtils.toString(url.openStream(), 
StandardCharsets.UTF_8);
-                }
-            } finally {
-                readLock.unlock();
-            }
-        }
-        return sourceCode;
-    }
-
-    @NotNull
-    @Override
-    public String getName() {
-        return url.getPath();
-    }
-
-    @Override
-    public void eval(@NotNull ScriptEngine scriptEngine, @NotNull 
ScriptContext context) throws ScriptException {
-        try {
-            if (scriptEngine instanceof Compilable &&
-                    (compiledScript == null || 
!scriptEngine.getFactory().equals(compiledScript.getEngine().getFactory()))) {
-                compilationLock.lock();
-                try {
-                    if (compiledScript == null || 
!scriptEngine.getFactory().equals(compiledScript.getEngine().getFactory())) {
-                        compiledScript =
-                                ((Compilable) scriptEngine)
-                                        .compile(new ScriptNameAwareReader(new 
StringReader(getSourceCode()), getName()));
-                    }
-                } finally {
-                    compilationLock.unlock();
-                }
-            }
-            if (compiledScript != null) {
-                compiledScript.eval(context);
-            } else {
-                scriptEngine.eval(getSourceCode(), context);
-            }
-        } catch (IOException e) {
-            throw new ScriptException(e);
-        }
-    }
-}
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
deleted file mode 100644
index caee87e..0000000
--- 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/ScriptContextProvider.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements.  See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership.  The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License.  You may obtain a copy of the License at
- ~
- ~   http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied.  See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker.internal;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.script.Bindings;
-import javax.script.ScriptContext;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
-
-import org.apache.sling.api.SlingHttpServletRequest;
-import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.api.scripting.LazyBindings;
-import org.apache.sling.api.scripting.SlingBindings;
-import org.apache.sling.api.scripting.SlingScriptConstants;
-import org.apache.sling.scripting.api.BindingsValuesProvider;
-import org.apache.sling.scripting.api.BindingsValuesProvidersByContext;
-import 
org.apache.sling.scripting.api.resource.ScriptingResourceResolverProvider;
-import org.apache.sling.scripting.bundle.tracker.BundledRenderUnit;
-import org.apache.sling.scripting.core.ScriptHelper;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Reference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@Component(
-        service = ScriptContextProvider.class
-)
-public class ScriptContextProvider {
-
-    private static final Set<String> PROTECTED_BINDINGS = 
Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
-            SlingBindings.REQUEST,
-            SlingBindings.RESPONSE,
-            SlingBindings.READER,
-            SlingBindings.RESOURCE,
-            SlingBindings.RESOLVER,
-            SlingBindings.OUT,
-            SlingBindings.LOG,
-            SlingBindings.SLING,
-            ScriptEngine.FILENAME,
-            BundledRenderUnit.VARIABLE
-    )));
-
-    @Reference
-    private BindingsValuesProvidersByContext bvpTracker;
-
-    @Reference
-    private ScriptEngineManager scriptEngineManager;
-
-    @Reference
-    private ScriptingResourceResolverProvider 
scriptingResourceResolverProvider;
-
-    ExecutableContext prepareScriptContext(SlingHttpServletRequest request, 
SlingHttpServletResponse response, Executable executable)
-            throws IOException {
-        ScriptEngine scriptEngine = 
scriptEngineManager.getEngineByName(executable.getScriptEngineName());
-        if (scriptEngine == null) {
-            throw new IllegalStateException(String.format("Cannot find a 
script engine with name %s for executable %s.",
-                    executable.getScriptEngineName(), executable.getPath()));
-        }
-        // prepare the SlingBindings
-        Bindings bindings = new LazyBindings();
-        bindings.put("properties", request.getResource().getValueMap());
-        bindings.put(SlingBindings.REQUEST, request);
-        bindings.put(SlingBindings.RESPONSE, response);
-        bindings.put(SlingBindings.READER, request.getReader());
-        bindings.put(SlingBindings.RESOURCE, request.getResource());
-        bindings.put(SlingBindings.RESOLVER, 
request.getResource().getResourceResolver());
-        bindings.put(SlingBindings.OUT, response.getWriter());
-        Logger scriptLogger = LoggerFactory.getLogger(executable.getName());
-        bindings.put(SlingBindings.LOG, scriptLogger);
-        bindings.put(SlingBindings.SLING, new 
ScriptHelper(executable.getBundle().getBundleContext(), null, request, 
response));
-        bindings.put(BundledRenderUnit.VARIABLE, executable);
-        bindings.put(ScriptEngine.FILENAME, executable.getName());
-        bindings.put(ScriptEngine.FILENAME.replaceAll("\\.", "_"), 
executable.getName());
-
-        ProtectedBindings protectedBindings = new ProtectedBindings(bindings, 
PROTECTED_BINDINGS);
-        for (BindingsValuesProvider bindingsValuesProvider : 
bvpTracker.getBindingsValuesProviders(scriptEngine.getFactory(),
-                BindingsValuesProvider.DEFAULT_CONTEXT)) {
-            bindingsValuesProvider.addBindings(protectedBindings);
-        }
-        ScriptContext scriptContext = new BundledScriptContext();
-        Map<String, LazyBindings.Supplier> slingBindingsSuppliers = new 
HashMap<>();
-        
slingBindingsSuppliers.put(SlingScriptConstants.ATTR_SCRIPT_RESOURCE_RESOLVER,
-                () -> 
scriptingResourceResolverProvider.getRequestScopedResourceResolver());
-        LazyBindings slingScopeBindings = new 
LazyBindings(slingBindingsSuppliers);
-        scriptContext.setBindings(slingScopeBindings, 
SlingScriptConstants.SLING_SCOPE);
-        scriptContext.setBindings(bindings, ScriptContext.ENGINE_SCOPE);
-        scriptContext.setWriter(response.getWriter());
-        scriptContext.setErrorWriter(new LogWriter(scriptLogger));
-        scriptContext.setReader(request.getReader());
-        return new ExecutableContext(scriptContext, executable, scriptEngine);
-    }
-
-    static class ExecutableContext {
-        private final ScriptContext scriptContext;
-        private final Executable executable;
-        private final ScriptEngine scriptEngine;
-
-        private ExecutableContext(ScriptContext scriptContext, Executable 
executable, ScriptEngine scriptEngine) {
-            this.scriptContext = scriptContext;
-            this.executable = executable;
-            this.scriptEngine = scriptEngine;
-        }
-
-        void eval() throws ScriptException {
-            executable.eval(scriptEngine, scriptContext);
-        }
-
-        void clean() {
-            Bindings engineBindings = 
scriptContext.getBindings(ScriptContext.ENGINE_SCOPE);
-            if (engineBindings != null && 
engineBindings.containsKey(SlingBindings.SLING)) {
-                Object scriptHelper = engineBindings.get(SlingBindings.SLING);
-                if (scriptHelper instanceof ScriptHelper) {
-                    ((ScriptHelper) scriptHelper).cleanup();
-                }
-            }
-            executable.releaseDependencies();
-        }
-    }
-
-
-}
diff --git 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/request/OnDemandReader.java
 
b/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/request/OnDemandReader.java
deleted file mode 100644
index 7af2e7c..0000000
--- 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/request/OnDemandReader.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements.  See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership.  The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License.  You may obtain a copy of the License at
- ~
- ~   http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied.  See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker.internal.request;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.nio.CharBuffer;
-
-import javax.servlet.ServletRequest;
-
-class OnDemandReader extends Reader {
-
-    private final ServletRequest request;
-
-    private Reader delegate;
-
-    OnDemandReader(ServletRequest request) {
-        this.request = request;
-    }
-
-    @Override
-    public void close() throws IOException {
-        if (delegate != null) {
-            delegate.close();
-        }
-    }
-
-    @Override
-    public void mark(int readAheadLimit) throws IOException {
-        getReader().mark(readAheadLimit);
-    }
-
-    @Override
-    public boolean markSupported() {
-        return (delegate != null) && delegate.markSupported();
-    }
-
-    @Override
-    public int read() throws IOException {
-        return getReader().read();
-    }
-
-    @Override
-    public int read(char[] cbuf, int off, int len) throws IOException {
-        return getReader().read(cbuf, off, len);
-    }
-
-    @Override
-    public int read(char[] cbuf) throws IOException {
-        return getReader().read(cbuf);
-    }
-
-    @Override
-    public int read(CharBuffer target) throws IOException {
-        return getReader().read(target);
-    }
-
-    @Override
-    public boolean ready() throws IOException {
-        return getReader().ready();
-    }
-
-    @Override
-    public void reset() throws IOException {
-        if (delegate != null) {
-            delegate.reset();
-        }
-    }
-
-    @Override
-    public long skip(long n) throws IOException {
-        return getReader().skip(n);
-    }
-
-    private Reader getReader() throws IOException {
-        if (delegate == null) {
-            delegate = request.getReader();
-        }
-        return delegate;
-    }
-}
diff --git 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/request/OnDemandWriter.java
 
b/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/request/OnDemandWriter.java
deleted file mode 100644
index c26ebba..0000000
--- 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/request/OnDemandWriter.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.scripting.bundle.tracker.internal.request;
-
-import java.io.IOException;
-import java.io.Writer;
-
-import javax.servlet.ServletResponse;
-
-class OnDemandWriter extends Writer {
-
-    private final ServletResponse response;
-
-    private Writer delegate;
-
-    OnDemandWriter(ServletResponse response) {
-        this.response = response;
-    }
-
-    private Writer getWriter() throws IOException {
-        if (delegate == null) {
-            delegate = response.getWriter();
-        }
-
-        return delegate;
-    }
-
-    @Override
-    public void write(int c) throws IOException {
-        synchronized (lock) {
-            getWriter().write(c);
-        }
-    }
-
-    @Override
-    public void write(char[] cbuf) throws IOException {
-        synchronized (lock) {
-            getWriter().write(cbuf);
-        }
-    }
-
-    @Override
-    public void write(char[] cbuf, int off, int len) throws IOException {
-        synchronized (lock) {
-            getWriter().write(cbuf, off, len);
-        }
-    }
-
-    @Override
-    public void write(String str) throws IOException {
-        synchronized (lock) {
-            getWriter().write(str);
-        }
-    }
-
-    @Override
-    public void write(String str, int off, int len) throws IOException {
-        synchronized (lock) {
-            getWriter().write(str, off, len);
-        }
-    }
-
-    @Override
-    public void flush() throws IOException {
-        synchronized (lock) {
-            Writer writer = delegate;
-            if (writer != null) {
-                writer.flush();
-            }
-        }
-    }
-
-    @Override
-    public void close() throws IOException {
-        synchronized (lock) {
-            // flush and close the delegate if existing, otherwise ignore
-            Writer writer = delegate;
-            if (writer != null) {
-                writer.flush();
-                writer.close();
-
-                // drop the delegate now
-                delegate = null;
-            }
-        }
-    }
-}
diff --git 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/request/ResponseWrapper.java
 
b/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/request/ResponseWrapper.java
deleted file mode 100644
index 88714ef..0000000
--- 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/request/ResponseWrapper.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements.  See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership.  The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License.  You may obtain a copy of the License at
- ~
- ~   http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied.  See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker.internal.request;
-
-import java.io.PrintWriter;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.api.wrappers.SlingHttpServletResponseWrapper;
-
-public class ResponseWrapper extends SlingHttpServletResponseWrapper {
-    private final AtomicReference<PrintWriter> writer = new 
AtomicReference<>();
-
-    /**
-     * Create a wrapper for the supplied wrappedRequest
-     *
-     * @param wrappedResponse The response
-     */
-    public ResponseWrapper(SlingHttpServletResponse wrappedResponse) {
-        super(wrappedResponse);
-    }
-
-    @Override
-    public PrintWriter getWriter() {
-        PrintWriter result = writer.get();
-        if (result == null) {
-            result = new PrintWriter(new OnDemandWriter(getResponse()));
-            if (!writer.compareAndSet(null, result)) {
-                result = writer.get();
-            }
-        }
-        return result;
-    }
-}
diff --git 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/BundledRenderUnitCapability.java
 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/BundledRenderUnitCapability.java
similarity index 98%
rename from 
src/main/java/org/apache/sling/scripting/bundle/tracker/BundledRenderUnitCapability.java
rename to 
src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/BundledRenderUnitCapability.java
index dbda3d6..e0693cb 100644
--- 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/BundledRenderUnitCapability.java
+++ 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/BundledRenderUnitCapability.java
@@ -16,7 +16,7 @@
  ~ specific language governing permissions and limitations
  ~ under the License.
  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker;
+package org.apache.sling.servlets.resolver.bundle.tracker;
 
 import java.util.List;
 import java.util.Set;
diff --git 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/package-info.java 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/BundledScriptFinder.java
similarity index 67%
copy from 
src/main/java/org/apache/sling/scripting/bundle/tracker/package-info.java
copy to 
src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/BundledScriptFinder.java
index 66d51bb..17f11fa 100644
--- a/src/main/java/org/apache/sling/scripting/bundle/tracker/package-info.java
+++ 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/BundledScriptFinder.java
@@ -16,7 +16,17 @@
  ~ specific language governing permissions and limitations
  ~ under the License.
  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-@Version("0.2.0")
-package org.apache.sling.scripting.bundle.tracker;
+package org.apache.sling.servlets.resolver.bundle.tracker;
 
-import org.osgi.annotation.versioning.Version;
+import java.util.Set;
+
+import org.jetbrains.annotations.NotNull;
+import org.osgi.framework.Bundle;
+
+public interface BundledScriptFinder {
+
+    Executable getScript(Set<TypeProvider> providers, Set<TypeProvider> 
allProviders);
+
+    Executable getScript(@NotNull Bundle bundle, @NotNull String path, 
@NotNull String scriptEngineName,
+                         @NotNull Set<TypeProvider> providers);
+}
diff --git 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/Executable.java
 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/Executable.java
similarity index 50%
rename from 
src/main/java/org/apache/sling/scripting/bundle/tracker/internal/Executable.java
rename to 
src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/Executable.java
index 8797103..207bff4 100644
--- 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/Executable.java
+++ 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/Executable.java
@@ -16,21 +16,14 @@
  ~ specific language governing permissions and limitations
  ~ under the License.
  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker.internal;
+package org.apache.sling.servlets.resolver.bundle.tracker;
 
-import javax.script.ScriptContext;
-import javax.script.ScriptEngine;
-import javax.script.ScriptException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 
-import org.apache.sling.scripting.bundle.tracker.BundledRenderUnit;
 import org.jetbrains.annotations.NotNull;
 
-interface Executable extends BundledRenderUnit {
-
-    /**
-     * Releases all acquired dependencies which were retrieved through {@link 
#getService(String)} or {@link #getServices(String, String)}.
-     */
-    void releaseDependencies();
+public interface Executable {
 
     /**
      * Returns the path of this executable in the resource type hierarchy. The 
path can be relative to the search paths or absolute.
@@ -41,20 +34,9 @@ interface Executable extends BundledRenderUnit {
     String getPath();
 
     /**
-     * Returns the short name of the {@link ScriptEngine} with which {@code 
this Executable} can be evaluated.
-     *
-     * @return the short name of the script engine
-     * @see #eval(ScriptEngine, ScriptContext)
-     */
-    @NotNull String getScriptEngineName();
-
-    /**
-     * Provided a {@link ScriptContext}, this method will execute / evaluate 
the wrapped script or precompiled script.
+     * This method will execute / evaluate the wrapped script or precompiled 
script with the given request.
      *
-     * @param scriptEngine a suitable script engine; see {@link 
#getScriptEngineName()} in order to see what {@link ScriptEngine}
-     *                     implementation is expected
-     * @param context      the {@link ScriptContext}
-     * @throws ScriptException if the execution leads to an error
+     * @throws Exception if the execution leads to an error
      */
-    void eval(@NotNull ScriptEngine scriptEngine, @NotNull ScriptContext 
context) throws ScriptException;
+    void eval(@NotNull HttpServletRequest request, @NotNull 
HttpServletResponse response) throws Exception;
 }
diff --git 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/ResourceType.java 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/ResourceType.java
similarity index 99%
rename from 
src/main/java/org/apache/sling/scripting/bundle/tracker/ResourceType.java
rename to 
src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/ResourceType.java
index b1399f1..31ee1dd 100644
--- a/src/main/java/org/apache/sling/scripting/bundle/tracker/ResourceType.java
+++ 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/ResourceType.java
@@ -16,7 +16,7 @@
  ~ specific language governing permissions and limitations
  ~ under the License.
  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker;
+package org.apache.sling.servlets.resolver.bundle.tracker;
 
 import java.util.Objects;
 import java.util.regex.Pattern;
diff --git 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/TypeProvider.java 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/TypeProvider.java
similarity index 96%
rename from 
src/main/java/org/apache/sling/scripting/bundle/tracker/TypeProvider.java
rename to 
src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/TypeProvider.java
index f508c52..7e36d7d 100644
--- a/src/main/java/org/apache/sling/scripting/bundle/tracker/TypeProvider.java
+++ 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/TypeProvider.java
@@ -16,7 +16,7 @@
  ~ specific language governing permissions and limitations
  ~ under the License.
  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker;
+package org.apache.sling.servlets.resolver.bundle.tracker;
 
 import org.jetbrains.annotations.NotNull;
 import org.osgi.annotation.versioning.ProviderType;
diff --git 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/BundledHooks.java
 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledHooks.java
similarity index 97%
rename from 
src/main/java/org/apache/sling/scripting/bundle/tracker/internal/BundledHooks.java
rename to 
src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledHooks.java
index 371df4b..49ce2a8 100644
--- 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/BundledHooks.java
+++ 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledHooks.java
@@ -16,7 +16,7 @@
  ~ specific language governing permissions and limitations
  ~ under the License.
  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker.internal;
+package org.apache.sling.servlets.resolver.bundle.tracker.internal;
 
 import java.util.Collection;
 import java.util.Iterator;
diff --git 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/BundledRenderUnitCapabilityImpl.java
 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledRenderUnitCapabilityImpl.java
similarity index 96%
rename from 
src/main/java/org/apache/sling/scripting/bundle/tracker/internal/BundledRenderUnitCapabilityImpl.java
rename to 
src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledRenderUnitCapabilityImpl.java
index 469f1e5..1d68f8e 100644
--- 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/BundledRenderUnitCapabilityImpl.java
+++ 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledRenderUnitCapabilityImpl.java
@@ -16,7 +16,7 @@
  ~ specific language governing permissions and limitations
  ~ under the License.
  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker.internal;
+package org.apache.sling.servlets.resolver.bundle.tracker.internal;
 
 import java.util.Arrays;
 import java.util.Collections;
@@ -28,8 +28,8 @@ import java.util.Set;
 
 import org.apache.sling.api.servlets.ServletResolverConstants;
 import org.apache.sling.commons.osgi.PropertiesUtil;
-import org.apache.sling.scripting.bundle.tracker.BundledRenderUnitCapability;
-import org.apache.sling.scripting.bundle.tracker.ResourceType;
+import 
org.apache.sling.servlets.resolver.bundle.tracker.BundledRenderUnitCapability;
+import org.apache.sling.servlets.resolver.bundle.tracker.ResourceType;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 import org.osgi.framework.Version;
diff --git 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/BundledScriptServlet.java
 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledScriptServlet.java
similarity index 76%
rename from 
src/main/java/org/apache/sling/scripting/bundle/tracker/internal/BundledScriptServlet.java
rename to 
src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledScriptServlet.java
index bfdb35e..f012634 100644
--- 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/BundledScriptServlet.java
+++ 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledScriptServlet.java
@@ -16,14 +16,13 @@
  ~ specific language governing permissions and limitations
  ~ under the License.
  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker.internal;
+package org.apache.sling.servlets.resolver.bundle.tracker.internal;
 
 import java.io.IOException;
 import java.util.Collection;
 import java.util.LinkedHashSet;
 import java.util.stream.Collectors;
 
-import javax.script.ScriptException;
 import javax.servlet.GenericServlet;
 import javax.servlet.ServletException;
 import javax.servlet.ServletRequest;
@@ -32,22 +31,19 @@ import javax.servlet.ServletResponse;
 import org.apache.sling.api.SlingConstants;
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.SlingHttpServletResponse;
-import org.apache.sling.scripting.bundle.tracker.TypeProvider;
-import 
org.apache.sling.scripting.bundle.tracker.internal.request.RequestWrapper;
-import 
org.apache.sling.scripting.bundle.tracker.internal.request.ResponseWrapper;
+import org.apache.sling.servlets.resolver.bundle.tracker.Executable;
+import org.apache.sling.servlets.resolver.bundle.tracker.TypeProvider;
+import 
org.apache.sling.servlets.resolver.bundle.tracker.internal.request.RequestWrapper;
 import org.jetbrains.annotations.NotNull;
 
 class BundledScriptServlet extends GenericServlet {
 
-    private final ScriptContextProvider scriptContextProvider;
     private final LinkedHashSet<TypeProvider> wiredTypeProviders;
     private final Executable executable;
 
 
-    BundledScriptServlet(@NotNull ScriptContextProvider scriptContextProvider,
-                         @NotNull LinkedHashSet<TypeProvider> 
wiredTypeProviders,
+    BundledScriptServlet(@NotNull LinkedHashSet<TypeProvider> 
wiredTypeProviders,
                          @NotNull Executable executable) {
-        this.scriptContextProvider = scriptContextProvider;
         this.wiredTypeProviders = wiredTypeProviders;
         this.executable = executable;
     }
@@ -71,22 +67,19 @@ class BundledScriptServlet extends GenericServlet {
             RequestWrapper requestWrapper = new RequestWrapper(request,
                     wiredTypeProviders.stream().map(typeProvider -> 
typeProvider.getBundledRenderUnitCapability().getResourceTypes()
             ).flatMap(Collection::stream).collect(Collectors.toSet()));
-            ScriptContextProvider.ExecutableContext executableContext = 
scriptContextProvider
-                    .prepareScriptContext(requestWrapper, new 
ResponseWrapper(response), executable);
             try {
-                executableContext.eval();
-            } catch (ScriptException se) {
+                executable.eval(requestWrapper, response);
+            } catch (Exception se) {
                 Throwable cause = (se.getCause() == null) ? se : se.getCause();
-                throw new ServletException(String.format("Failed executing 
script %s: %s", executable.getName(), se.getMessage()), cause);
-            } finally {
-                executableContext.clean();
+                throw new ServletException(String.format("Failed executing 
script %s: %s", executable.getPath(), se.getMessage()), cause);
             }
         } else {
             throw new ServletException("Not a Sling HTTP request/response");
         }
     }
 
+    @Override
     public String toString() {
-        return getClass().getSimpleName() + "(" + executable.getName() + ")";
+        return getClass().getSimpleName() + "(" + executable.getPath() + ")";
     }
 }
diff --git 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/BundledScriptTracker.java
 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledScriptTracker.java
similarity index 97%
rename from 
src/main/java/org/apache/sling/scripting/bundle/tracker/internal/BundledScriptTracker.java
rename to 
src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledScriptTracker.java
index f23c9bd..318262d 100644
--- 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/BundledScriptTracker.java
+++ 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledScriptTracker.java
@@ -16,12 +16,11 @@
  ~ specific language governing permissions and limitations
  ~ under the License.
  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker.internal;
+package org.apache.sling.servlets.resolver.bundle.tracker.internal;
 
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -31,7 +30,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
-import java.util.function.Supplier;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -50,9 +48,12 @@ import org.apache.sling.api.SlingHttpServletResponse;
 import org.apache.sling.api.request.RequestDispatcherOptions;
 import org.apache.sling.api.servlets.ServletResolverConstants;
 import org.apache.sling.commons.osgi.PropertiesUtil;
-import org.apache.sling.scripting.bundle.tracker.ResourceType;
-import org.apache.sling.scripting.bundle.tracker.BundledRenderUnitCapability;
-import org.apache.sling.scripting.bundle.tracker.TypeProvider;
+import org.apache.sling.servlets.resolver.bundle.tracker.BundledScriptFinder;
+import org.apache.sling.servlets.resolver.bundle.tracker.Executable;
+import org.apache.sling.servlets.resolver.bundle.tracker.ResourceType;
+import 
org.apache.sling.servlets.resolver.bundle.tracker.BundledRenderUnitCapability;
+import org.apache.sling.servlets.resolver.bundle.tracker.TypeProvider;
+import org.apache.sling.servlets.resolver.internal.resource.ServletMounter;
 import org.jetbrains.annotations.NotNull;
 import org.osgi.annotation.bundle.Capability;
 import org.osgi.framework.Bundle;
@@ -86,7 +87,7 @@ public class BundledScriptTracker implements 
BundleTrackerCustomizer<List<Servic
     static final String NS_SLING_SCRIPTING_EXTENDER = "sling.scripting";
 
     private static final Logger LOGGER = 
LoggerFactory.getLogger(BundledScriptTracker.class);
-    private static final String REGISTERING_BUNDLE = 
"org.apache.sling.scripting.bundle.tracker.internal.BundledScriptTracker.registering_bundle";
+    private static final String REGISTERING_BUNDLE = 
"BundledScriptTracker.registering_bundle";
     public static final String NS_SLING_SERVLET = "sling.servlet";
     public static final String AT_VERSION = "version";
     public static final String AT_SCRIPT_ENGINE = "scriptEngine";
@@ -97,8 +98,7 @@ public class BundledScriptTracker implements 
BundleTrackerCustomizer<List<Servic
     private BundledScriptFinder bundledScriptFinder;
 
     @Reference
-    private ScriptContextProvider scriptContextProvider;
-
+    private ServletMounter mounter;
 
     private volatile BundleContext m_context;
     private volatile BundleTracker<List<ServiceRegistration<Servlet>>> 
m_tracker;
@@ -196,7 +196,7 @@ public class BundledScriptTracker implements 
BundleTrackerCustomizer<List<Servic
                         regs.add(
                                 bundle.getBundleContext().registerService(
                                         Servlet.class,
-                                        new 
BundledScriptServlet(scriptContextProvider, inheritanceChain, executable),
+                                        new 
BundledScriptServlet(inheritanceChain, executable),
                                         properties
                                 )
                         );
diff --git 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/TypeProviderImpl.java
 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/TypeProviderImpl.java
similarity index 89%
rename from 
src/main/java/org/apache/sling/scripting/bundle/tracker/internal/TypeProviderImpl.java
rename to 
src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/TypeProviderImpl.java
index fe04d66..63c67cf 100644
--- 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/TypeProviderImpl.java
+++ 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/TypeProviderImpl.java
@@ -16,15 +16,17 @@
  ~ specific language governing permissions and limitations
  ~ under the License.
  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker.internal;
+package org.apache.sling.servlets.resolver.bundle.tracker.internal;
 
 import java.util.Objects;
 
-import org.apache.sling.scripting.bundle.tracker.BundledRenderUnitCapability;
+import 
org.apache.sling.servlets.resolver.bundle.tracker.BundledRenderUnitCapability;
+import org.apache.sling.servlets.resolver.bundle.tracker.TypeProvider;
 import org.jetbrains.annotations.NotNull;
 import org.osgi.framework.Bundle;
 
-class TypeProviderImpl implements 
org.apache.sling.scripting.bundle.tracker.TypeProvider {
+class TypeProviderImpl implements TypeProvider
+{
 
     private final BundledRenderUnitCapability bundledRenderUnitCapability;
     private final Bundle bundle;
diff --git 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/request/RequestWrapper.java
 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/request/RequestWrapper.java
similarity index 89%
rename from 
src/main/java/org/apache/sling/scripting/bundle/tracker/internal/request/RequestWrapper.java
rename to 
src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/request/RequestWrapper.java
index e80663a..5e20069 100644
--- 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/internal/request/RequestWrapper.java
+++ 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/request/RequestWrapper.java
@@ -16,10 +16,8 @@
  ~ specific language governing permissions and limitations
  ~ under the License.
  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker.internal.request;
+package org.apache.sling.servlets.resolver.bundle.tracker.internal.request;
 
-import java.io.BufferedReader;
-import java.io.IOException;
 import java.util.Set;
 
 import javax.servlet.RequestDispatcher;
@@ -29,12 +27,11 @@ import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.request.RequestDispatcherOptions;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.wrappers.SlingHttpServletRequestWrapper;
-import org.apache.sling.scripting.bundle.tracker.ResourceType;
+import org.apache.sling.servlets.resolver.bundle.tracker.ResourceType;
 
 public class RequestWrapper extends SlingHttpServletRequestWrapper {
 
     private final Set<ResourceType> wiredResourceTypes;
-    private BufferedReader reader;
 
     public RequestWrapper(SlingHttpServletRequest wrappedRequest, 
Set<ResourceType> wiredResourceTypes) {
         super(wrappedRequest);
@@ -62,14 +59,6 @@ public class RequestWrapper extends 
SlingHttpServletRequestWrapper {
         return super.getRequestDispatcher(path, processedOptions);
     }
 
-    @Override
-    public BufferedReader getReader() {
-        if (reader == null) {
-            reader = new BufferedReader(new OnDemandReader(getRequest()));
-        }
-        return reader;
-    }
-
     private RequestDispatcherOptions processOptions(RequestDispatcherOptions 
options) {
         if (options != null) {
             RequestDispatcherOptions requestDispatcherOptions = new 
RequestDispatcherOptions();
diff --git 
a/src/main/java/org/apache/sling/scripting/bundle/tracker/package-info.java 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/package-info.java
similarity index 94%
rename from 
src/main/java/org/apache/sling/scripting/bundle/tracker/package-info.java
rename to 
src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/package-info.java
index 66d51bb..91b289b 100644
--- a/src/main/java/org/apache/sling/scripting/bundle/tracker/package-info.java
+++ 
b/src/main/java/org/apache/sling/servlets/resolver/bundle/tracker/package-info.java
@@ -17,6 +17,6 @@
  ~ under the License.
  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
 @Version("0.2.0")
-package org.apache.sling.scripting.bundle.tracker;
+package org.apache.sling.servlets.resolver.bundle.tracker;
 
 import org.osgi.annotation.versioning.Version;
diff --git 
a/src/main/java/org/apache/sling/servlets/resolver/internal/ResolverConfig.java 
b/src/main/java/org/apache/sling/servlets/resolver/internal/ResolverConfig.java
index 21941d8..06463c9 100644
--- 
a/src/main/java/org/apache/sling/servlets/resolver/internal/ResolverConfig.java
+++ 
b/src/main/java/org/apache/sling/servlets/resolver/internal/ResolverConfig.java
@@ -62,5 +62,5 @@ public @interface ResolverConfig {
     @AttributeDefinition(name = "Mount Providers", description = "Should 
servlets be mounted as resource providers?" +
         " If true (the default), servlets will be represented in the content 
tree using resource provider -" +
         " otherwise, servlets will be decorated back into the content tree 
using a decorator.")
-    boolean servletresolver_mountProviders() default true;
+    boolean servletresolver_mountProviders() default false;
 }
diff --git 
a/src/main/java/org/apache/sling/servlets/resolver/internal/resource/ServletMounter.java
 
b/src/main/java/org/apache/sling/servlets/resolver/internal/resource/ServletMounter.java
index 1eb5866..bc772ab 100644
--- 
a/src/main/java/org/apache/sling/servlets/resolver/internal/resource/ServletMounter.java
+++ 
b/src/main/java/org/apache/sling/servlets/resolver/internal/resource/ServletMounter.java
@@ -64,8 +64,7 @@ import org.slf4j.LoggerFactory;
  * The resolver uses an own session to find the scripts.
  *
  */
-@Component(configurationPid = ResolverConfig.PID,
-           service = {})
+@Component(configurationPid = ResolverConfig.PID, immediate = true, service = 
{ServletMounter.class})
 public class ServletMounter {
 
     /** Logger */
diff --git 
a/src/test/java/org/apache/sling/scripting/bundle/tracker/internal/BundledScriptContextTest.java
 
b/src/test/java/org/apache/sling/scripting/bundle/tracker/internal/BundledScriptContextTest.java
deleted file mode 100644
index 0a26503..0000000
--- 
a/src/test/java/org/apache/sling/scripting/bundle/tracker/internal/BundledScriptContextTest.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements.  See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership.  The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License.  You may obtain a copy of the License at
- ~
- ~   http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied.  See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker.internal;
-
-import javax.script.Bindings;
-import javax.script.ScriptContext;
-import javax.script.SimpleBindings;
-
-import org.apache.sling.api.scripting.SlingScriptConstants;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-public class BundledScriptContextTest {
-
-    @Test
-    public void testSetAndGetBindings() {
-        BundledScriptContext bundledScriptContext = new BundledScriptContext();
-        Bindings engineScope = new SimpleBindings();
-        Bindings globalScope = new SimpleBindings();
-        Bindings slingScope = new SimpleBindings();
-
-        bundledScriptContext.setBindings(slingScope, 
SlingScriptConstants.SLING_SCOPE);
-        bundledScriptContext.setBindings(globalScope, 
ScriptContext.GLOBAL_SCOPE);
-        bundledScriptContext.setBindings(engineScope, 
ScriptContext.ENGINE_SCOPE);
-
-        assertEquals(engineScope, 
bundledScriptContext.getBindings(ScriptContext.ENGINE_SCOPE));
-        assertEquals(globalScope, 
bundledScriptContext.getBindings(ScriptContext.GLOBAL_SCOPE));
-        assertEquals(slingScope, 
bundledScriptContext.getBindings(SlingScriptConstants.SLING_SCOPE));
-
-        boolean invalidScopeThrowsException;
-        try {
-            bundledScriptContext.getBindings(Integer.MIN_VALUE);
-            invalidScopeThrowsException = false;
-        } catch (Exception e) {
-            invalidScopeThrowsException = true;
-        }
-        assertTrue(BundledScriptContext.class.getName() + " should throw 
exceptions for invalid scopes.", invalidScopeThrowsException);
-
-        boolean acceptsAnyScope;
-        try {
-            bundledScriptContext.setBindings(new SimpleBindings(), 
Integer.MIN_VALUE);
-            acceptsAnyScope = true;
-        } catch (Exception e) {
-            acceptsAnyScope = false;
-        }
-        assertFalse(BundledScriptContext.class.getName() + " should not accept 
bindings for arbitrary scopes.", acceptsAnyScope);
-
-        boolean acceptsNullBindings;
-        try {
-            bundledScriptContext.setBindings(null, ScriptContext.ENGINE_SCOPE);
-            acceptsNullBindings = true;
-        } catch (Exception e) {
-            acceptsNullBindings = false;
-        }
-        assertFalse(BundledScriptContext.class.getName() + " should not accept 
null bindings.", acceptsNullBindings);
-    }
-
-    @Test
-    public void testSetAndGetAttribute() {
-        BundledScriptContext bundledScriptContext = new BundledScriptContext();
-        boolean acceptsSettingNullAttributeNames;
-        try {
-            bundledScriptContext.setAttribute(null, 0, 
ScriptContext.ENGINE_SCOPE);
-            acceptsSettingNullAttributeNames = true;
-        } catch (Exception e) {
-            acceptsSettingNullAttributeNames = false;
-        }
-        assertFalse(BundledScriptContext.class.getName() + " should not accept 
null attribute names.", acceptsSettingNullAttributeNames);
-
-        boolean acceptsRetrievingNullAttributeNamesFromScope;
-        try {
-            bundledScriptContext.getAttribute(null, 
ScriptContext.ENGINE_SCOPE);
-            acceptsRetrievingNullAttributeNamesFromScope = true;
-        } catch (Exception e) {
-            acceptsRetrievingNullAttributeNamesFromScope = false;
-        }
-        assertFalse(BundledScriptContext.class.getName() + " should not accept 
null attribute names.", acceptsRetrievingNullAttributeNamesFromScope);
-
-        boolean acceptsRetrievingNullAttributeNames;
-        try {
-            bundledScriptContext.getAttribute(null);
-            acceptsRetrievingNullAttributeNames = true;
-        } catch (Exception e) {
-            acceptsRetrievingNullAttributeNames = false;
-        }
-        assertFalse(BundledScriptContext.class.getName() + " should not accept 
null attribute names.", acceptsRetrievingNullAttributeNames);
-
-        bundledScriptContext.setAttribute("nothing", 0, 
ScriptContext.ENGINE_SCOPE);
-        assertEquals(0, bundledScriptContext.getAttribute("nothing"));
-        assertEquals(0, bundledScriptContext.getAttribute("nothing", 
ScriptContext.ENGINE_SCOPE));
-        assertNull(bundledScriptContext.getAttribute("nothing", 
ScriptContext.GLOBAL_SCOPE));
-    }
-
-    @Test
-    public void testRemoveAttribute() {
-        BundledScriptContext bundledScriptContext = new BundledScriptContext();
-        boolean acceptsNullAttributeNames;
-        try {
-            bundledScriptContext.removeAttribute(null, 
ScriptContext.ENGINE_SCOPE);
-            acceptsNullAttributeNames = true;
-        } catch (Exception e) {
-            acceptsNullAttributeNames = false;
-        }
-        assertFalse(BundledScriptContext.class.getName() + " should not accept 
null attribute names.", acceptsNullAttributeNames);
-
-        bundledScriptContext.setAttribute("nothing", 0, 
ScriptContext.ENGINE_SCOPE);
-        assertEquals(0, bundledScriptContext.removeAttribute("nothing", 
ScriptContext.ENGINE_SCOPE));
-        Bindings engineScope = 
bundledScriptContext.getBindings(ScriptContext.ENGINE_SCOPE);
-        assertTrue( engineScope != null && engineScope.size() == 0);
-        assertNull(bundledScriptContext.removeAttribute("nothing", 
ScriptContext.ENGINE_SCOPE));
-        assertNull(bundledScriptContext.removeAttribute("nothing", 
ScriptContext.GLOBAL_SCOPE));
-    }
-
-    @Test
-    public void testGetAttributesScope() {
-        BundledScriptContext bundledScriptContext = new BundledScriptContext();
-        boolean acceptsNullAttributeNames;
-        try {
-            bundledScriptContext.getAttributesScope(null);
-            acceptsNullAttributeNames = true;
-        } catch (Exception e) {
-            acceptsNullAttributeNames = false;
-        }
-        assertFalse(BundledScriptContext.class.getName() + " should not accept 
null attribute names.", acceptsNullAttributeNames);
-
-        bundledScriptContext.setAttribute("nothing", 0, 
SlingScriptConstants.SLING_SCOPE);
-        assertEquals(SlingScriptConstants.SLING_SCOPE, 
bundledScriptContext.getAttributesScope("nothing"));
-        assertEquals(-1, bundledScriptContext.getAttributesScope("nothing 
here"));
-    }
-
-}
diff --git 
a/src/test/java/org/apache/sling/scripting/bundle/tracker/internal/LogWriterTest.java
 
b/src/test/java/org/apache/sling/scripting/bundle/tracker/internal/LogWriterTest.java
deleted file mode 100644
index bb5fe26..0000000
--- 
a/src/test/java/org/apache/sling/scripting/bundle/tracker/internal/LogWriterTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements.  See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership.  The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License.  You may obtain a copy of the License at
- ~
- ~   http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied.  See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker.internal;
-
-import org.junit.Test;
-import org.slf4j.Logger;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyNoMoreInteractions;
-
-public class LogWriterTest {
-
-    @Test
-    public void testLogWriterCRLFFlush() {
-        Logger mockedLogger = mock(Logger.class);
-        LogWriter writer = new LogWriter(mockedLogger);
-        char[] buffer = "Test CRLF 1\nTest CRLF 2".toCharArray();
-        writer.write(buffer, 0, buffer.length);
-        verify(mockedLogger).error("Test CRLF 1");
-        writer.flush();
-        verify(mockedLogger).error("Test CRLF 2");
-        verifyNoMoreInteractions(mockedLogger);
-        writer.flush();
-        writer.close();
-    }
-
-    @Test
-    public void testLogWriterCharWriteAndFlush() {
-        Logger mockedLogger = mock(Logger.class);
-        LogWriter writer = new LogWriter(mockedLogger);
-        writer.write('a');
-        writer.write('\n');
-        verify(mockedLogger).error("a");
-        writer.write('a');
-        writer.write('b');
-        writer.write('c');
-        writer.close();
-        verify(mockedLogger).error("abc");
-    }
-
-
-
-}
diff --git 
a/src/test/java/org/apache/sling/scripting/bundle/tracker/internal/ProtectedBindingsTest.java
 
b/src/test/java/org/apache/sling/scripting/bundle/tracker/internal/ProtectedBindingsTest.java
deleted file mode 100644
index 82d2a9a..0000000
--- 
a/src/test/java/org/apache/sling/scripting/bundle/tracker/internal/ProtectedBindingsTest.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements.  See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership.  The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License.  You may obtain a copy of the License at
- ~
- ~   http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied.  See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker.internal;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.script.Bindings;
-import javax.script.SimpleBindings;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
-public class ProtectedBindingsTest {
-
-    @Test
-    public void put() {
-        ProtectedBindings bindings = getBindingsUnderTest();
-        bindings.put("d", 4);
-        boolean allowsOverride;
-        try {
-            bindings.put("c", 0);
-            allowsOverride = true;
-        } catch (IllegalArgumentException e) {
-            allowsOverride = false;
-        }
-        assertFalse("Protected keys were overwritten.", allowsOverride);
-        assertEquals("Expected that unprotected keys can be used.", 4, 
bindings.get("d"));
-    }
-
-    @Test
-    public void putAll() {
-        ProtectedBindings bindings = getBindingsUnderTest();
-        boolean allowsOverride;
-        try {
-            bindings.putAll(new HashMap<String, Object>(){{
-                put("a", 0);
-                put("b", 0);
-                put("c", 0);
-            }});
-            allowsOverride = true;
-        } catch (IllegalArgumentException e) {
-            allowsOverride = false;
-        }
-        assertFalse("Protected keys were overwritten", allowsOverride);
-        bindings.putAll(new HashMap<String, Object>(){{
-            put("d", 4);
-            put("e", 5);
-            put("f", 6);
-        }});
-        assertTrue("Expected that the bindings contain non-conflicting 
additions.", bindings.size() == 6 && bindings.get("d").equals(4)
-                && bindings.get("e").equals(5) && bindings.get("f").equals(6));
-    }
-
-    @Test
-    public void remove() {
-        ProtectedBindings bindings = getBindingsUnderTest();
-        boolean allowsOverride;
-        try {
-            bindings.remove("a");
-            allowsOverride = true;
-        } catch (IllegalArgumentException e) {
-            allowsOverride = false;
-        }
-        assertFalse("Protected keys were overwritten.", allowsOverride);
-        assertEquals("Expected that protected key was not removed.", 1, 
bindings.get("a"));
-        bindings.put("d", 4);
-        assertEquals(4, bindings.size());
-        assertEquals(4, bindings.remove("d"));
-    }
-
-    @Test
-    public void clear() {
-        ProtectedBindings bindings = getBindingsUnderTest();
-        boolean hasThrownUOE = false;
-        try {
-            bindings.clear();
-        } catch (UnsupportedOperationException e) {
-            hasThrownUOE = true;
-        }
-        assertTrue("Expected an UnsupportedOperationException.", hasThrownUOE);
-        assertTrue("Expected map to not be modified.", bindings.size() == 3 && 
bindings.get("a").equals(1) && bindings.get("b").equals(2)
-                && bindings.get("c").equals(3));
-    }
-
-    @Test
-    public void containsValue() {
-        Bindings bindings = mock(Bindings.class);
-        ProtectedBindings protectedBindings = new ProtectedBindings(bindings, 
Collections.emptySet());
-        protectedBindings.containsValue(4);
-        verify(bindings).containsValue(4);
-    }
-
-    @Test
-    public void entrySet() {
-        ProtectedBindings bindings = getBindingsUnderTest();
-        Set<Map.Entry<String, Object>> entrySet = bindings.entrySet();
-        assertEquals(3, entrySet.size());
-        boolean unmodifiable;
-        try {
-            entrySet.clear();
-            unmodifiable = false;
-        } catch (UnsupportedOperationException e) {
-            unmodifiable = true;
-        }
-        assertTrue("Expected an unmodifiable entry set.", unmodifiable);
-    }
-
-    @Test
-    public void isEmpty() {
-        Bindings bindings = mock(Bindings.class);
-        ProtectedBindings protectedBindings = new ProtectedBindings(bindings, 
Collections.emptySet());
-        protectedBindings.isEmpty();
-        verify(bindings).isEmpty();
-    }
-
-    @Test
-    public void keySet() {
-        ProtectedBindings bindings = getBindingsUnderTest();
-        Set<String> keySet = bindings.keySet();
-        assertEquals(3, keySet.size());
-        boolean unmodifiable;
-        try {
-            keySet.clear();
-            unmodifiable = false;
-        } catch (UnsupportedOperationException e) {
-            unmodifiable = true;
-        }
-        assertTrue("Expected an unmodifiable key set.", unmodifiable);
-    }
-
-    @Test
-    public void size() {
-        Bindings bindings = mock(Bindings.class);
-        ProtectedBindings protectedBindings = new ProtectedBindings(bindings, 
Collections.emptySet());
-        protectedBindings.size();
-        verify(bindings).size();
-    }
-
-    @Test
-    public void values() {
-        ProtectedBindings bindings = getBindingsUnderTest();
-        Collection<Object> values = bindings.values();
-        assertEquals(3, values.size());
-        boolean unmodifiable;
-        try {
-            values.clear();
-            unmodifiable = false;
-        } catch (UnsupportedOperationException e) {
-            unmodifiable = true;
-        }
-        assertTrue("Expected an unmodifiable values collection.", 
unmodifiable);
-    }
-
-    @Test
-    public void containsKey() {
-        Bindings bindings = mock(Bindings.class);
-        ProtectedBindings protectedBindings = new ProtectedBindings(bindings, 
Collections.emptySet());
-        protectedBindings.containsKey("a");
-        verify(bindings).containsKey("a");
-    }
-
-    @Test
-    public void get() {
-        Bindings bindings = mock(Bindings.class);
-        ProtectedBindings protectedBindings = new ProtectedBindings(bindings, 
Collections.emptySet());
-        protectedBindings.get("a");
-        verify(bindings).get("a");
-    }
-
-    private ProtectedBindings getBindingsUnderTest() {
-        Bindings bindings = new SimpleBindings();
-        bindings.put("a", 1);
-        bindings.put("b", 2);
-        bindings.put("c", 3);
-        Set<String> protectedKeys = new HashSet<>(Arrays.asList("a", "b", 
"c"));
-        return new ProtectedBindings(bindings, protectedKeys);
-    }
-}
diff --git 
a/src/test/java/org/apache/sling/scripting/bundle/tracker/ResourceTypeTest.java 
b/src/test/java/org/apache/sling/servlets/resolver/bundle/tracker/ResourceTypeTest.java
similarity index 98%
rename from 
src/test/java/org/apache/sling/scripting/bundle/tracker/ResourceTypeTest.java
rename to 
src/test/java/org/apache/sling/servlets/resolver/bundle/tracker/ResourceTypeTest.java
index 8f102e9..5464bd1 100644
--- 
a/src/test/java/org/apache/sling/scripting/bundle/tracker/ResourceTypeTest.java
+++ 
b/src/test/java/org/apache/sling/servlets/resolver/bundle/tracker/ResourceTypeTest.java
@@ -16,7 +16,7 @@
  ~ specific language governing permissions and limitations
  ~ under the License.
  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker;
+package org.apache.sling.servlets.resolver.bundle.tracker;
 
 import org.apache.commons.lang3.StringUtils;
 import org.junit.Test;
diff --git 
a/src/test/java/org/apache/sling/scripting/bundle/tracker/internal/BundledHooksTest.java
 
b/src/test/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledHooksTest.java
similarity index 98%
rename from 
src/test/java/org/apache/sling/scripting/bundle/tracker/internal/BundledHooksTest.java
rename to 
src/test/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledHooksTest.java
index 1b974fb..95ea271 100644
--- 
a/src/test/java/org/apache/sling/scripting/bundle/tracker/internal/BundledHooksTest.java
+++ 
b/src/test/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledHooksTest.java
@@ -16,7 +16,7 @@
  ~ specific language governing permissions and limitations
  ~ under the License.
  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker.internal;
+package org.apache.sling.servlets.resolver.bundle.tracker.internal;
 
 import java.util.ArrayList;
 import java.util.Arrays;
diff --git 
a/src/test/java/org/apache/sling/scripting/bundle/tracker/internal/BundledScriptTrackerTest.java
 
b/src/test/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledScriptTrackerTest.java
similarity index 96%
rename from 
src/test/java/org/apache/sling/scripting/bundle/tracker/internal/BundledScriptTrackerTest.java
rename to 
src/test/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledScriptTrackerTest.java
index 022ff35..429017b 100644
--- 
a/src/test/java/org/apache/sling/scripting/bundle/tracker/internal/BundledScriptTrackerTest.java
+++ 
b/src/test/java/org/apache/sling/servlets/resolver/bundle/tracker/internal/BundledScriptTrackerTest.java
@@ -16,7 +16,7 @@
  ~ specific language governing permissions and limitations
  ~ under the License.
  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-package org.apache.sling.scripting.bundle.tracker.internal;
+package org.apache.sling.servlets.resolver.bundle.tracker.internal;
 
 import java.util.ArrayList;
 import java.util.List;
diff --git 
a/src/test/java/org/apache/sling/servlets/resolver/it/ServletResolverTestSupport.java
 
b/src/test/java/org/apache/sling/servlets/resolver/it/ServletResolverTestSupport.java
index 2062fa7..405caa7 100644
--- 
a/src/test/java/org/apache/sling/servlets/resolver/it/ServletResolverTestSupport.java
+++ 
b/src/test/java/org/apache/sling/servlets/resolver/it/ServletResolverTestSupport.java
@@ -76,7 +76,6 @@ public class ServletResolverTestSupport extends TestSupport {
         final String vmOpt = System.getProperty("pax.vm.options");
         versionResolver.setVersionFromProject("org.apache.sling", 
"org.apache.sling.api");
         versionResolver.setVersionFromProject("org.apache.sling", 
"org.apache.sling.resourceresolver");
-        versionResolver.setVersionFromProject("org.apache.sling", 
"org.apache.sling.scripting.api");
         versionResolver.setVersionFromProject("org.apache.sling", 
"org.apache.sling.scripting.core");
         return options(
             composite(
@@ -88,7 +87,6 @@ public class ServletResolverTestSupport extends TestSupport {
                 
mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.converter").version("1.0.12"),
 // new Sling API dependency
                 testBundle("bundle.filename"),
                 
mavenBundle().groupId("org.apache.sling").artifactId("org.apache.sling.servlet-helpers").versionAsInProject(),
-                
mavenBundle().groupId("org.apache.sling").artifactId("org.apache.sling.commons.compiler").versionAsInProject(),
                 junitBundles(),
                 
newConfiguration("org.apache.sling.jcr.base.internal.LoginAdminWhitelist")
                     .put("whitelist.bundles.regexp", "^PAXEXAM.*$")

Reply via email to