Search in sources :

Example 26 with SlingScriptHelper

use of org.apache.sling.api.scripting.SlingScriptHelper in project sling by apache.

the class GetPropertyTag method getClassLoader.

/**
	 * Method for retrieving the classloader from the OSGi console.
	 * 
	 * @return the classloader
	 */
protected ClassLoader getClassLoader() {
    final SlingBindings bindings = (SlingBindings) pageContext.getRequest().getAttribute(SlingBindings.class.getName());
    final SlingScriptHelper scriptHelper = bindings.getSling();
    final DynamicClassLoaderManager dynamicClassLoaderManager = scriptHelper.getService(DynamicClassLoaderManager.class);
    final ClassLoader classLoader = dynamicClassLoaderManager.getDynamicClassLoader();
    return classLoader;
}
Also used : SlingBindings(org.apache.sling.api.scripting.SlingBindings) SlingScriptHelper(org.apache.sling.api.scripting.SlingScriptHelper) DynamicClassLoaderManager(org.apache.sling.commons.classloader.DynamicClassLoaderManager)

Aggregations

SlingScriptHelper (org.apache.sling.api.scripting.SlingScriptHelper)26 SlingBindings (org.apache.sling.api.scripting.SlingBindings)15 Resource (org.apache.sling.api.resource.Resource)12 Bindings (javax.script.Bindings)10 ResourceResolver (org.apache.sling.api.resource.ResourceResolver)9 SlingHttpServletRequest (org.apache.sling.api.SlingHttpServletRequest)8 SlingHttpServletResponse (org.apache.sling.api.SlingHttpServletResponse)5 ScriptException (javax.script.ScriptException)4 IOException (java.io.IOException)3 InputStream (java.io.InputStream)3 InputStreamReader (java.io.InputStreamReader)3 Servlet (javax.servlet.Servlet)3 ServletResolver (org.apache.sling.api.servlets.ServletResolver)3 SightlyException (org.apache.sling.scripting.sightly.SightlyException)3 Test (org.junit.Test)3 BufferedReader (java.io.BufferedReader)2 Reader (java.io.Reader)2 Locale (java.util.Locale)2 JspException (javax.servlet.jsp.JspException)2 BodyContent (javax.servlet.jsp.tagext.BodyContent)2