Package org.apache.sling.scripting.core
Klasse ScriptHelper
java.lang.Object
org.apache.sling.scripting.core.ScriptHelper
- Alle implementierten Schnittstellen:
org.apache.sling.api.scripting.SlingScriptHelper
public class ScriptHelper
extends Object
implements org.apache.sling.api.scripting.SlingScriptHelper
Simple script helper providing access to the (wrapped) response, the
on-demand writer and a simple API for request inclusion. Instances of this
class are made available to the scripts as the global
sling
variable.
Client code using this object should take care to call cleanup()
when the object is not used anymore!-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungprotected final org.osgi.framework.BundleContextThe bundle context.protected List<org.osgi.framework.ServiceReference<?>> The list of references - we don't need to synchronize this as we are running in one single request.A map of found services. -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungScriptHelper(org.osgi.framework.BundleContext ctx, org.apache.sling.api.scripting.SlingScript script) ScriptHelper(org.osgi.framework.BundleContext ctx, org.apache.sling.api.scripting.SlingScript script, org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response) Veraltet.ScriptHelper(org.osgi.framework.BundleContext ctx, org.apache.sling.api.scripting.SlingScript script, org.apache.sling.api.SlingJakartaHttpServletRequest request, org.apache.sling.api.SlingJakartaHttpServletResponse response) Creates a new script helper instance. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoidcleanup()Clean up this instance.voiddispose()Veraltet.This method is deprecated and should never be called by clients!voidvoidvoidvoidforward(org.apache.sling.api.resource.Resource resource) voidvoidforward(org.apache.sling.api.resource.Resource resource, org.apache.sling.api.request.RequestDispatcherOptions options) org.apache.sling.api.SlingJakartaHttpServletRequestorg.apache.sling.api.SlingJakartaHttpServletResponseorg.apache.sling.api.SlingHttpServletRequestorg.apache.sling.api.SlingHttpServletResponseorg.apache.sling.api.scripting.SlingScript<T> TgetService(Class<T> type) <T> T[]getServices(Class<T> serviceType, String filter) voidvoidvoidvoidinclude(org.apache.sling.api.resource.Resource resource) voidvoidinclude(org.apache.sling.api.resource.Resource resource, org.apache.sling.api.request.RequestDispatcherOptions options)
-
Felddetails
-
bundleContext
protected final org.osgi.framework.BundleContext bundleContextThe bundle context. -
references
The list of references - we don't need to synchronize this as we are running in one single request. -
services
A map of found services.
-
-
Konstruktordetails
-
ScriptHelper
public ScriptHelper(org.osgi.framework.BundleContext ctx, org.apache.sling.api.scripting.SlingScript script) -
ScriptHelper
public ScriptHelper(org.osgi.framework.BundleContext ctx, org.apache.sling.api.scripting.SlingScript script, org.apache.sling.api.SlingJakartaHttpServletRequest request, org.apache.sling.api.SlingJakartaHttpServletResponse response) Creates a new script helper instance.- Parameter:
ctx- The bundle context, must not benull.script- The script, must not benull.request- The request, may benull.response- The response, may benull.- Seit:
- 2.2.0
-
ScriptHelper
@Deprecated public ScriptHelper(org.osgi.framework.BundleContext ctx, org.apache.sling.api.scripting.SlingScript script, org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response) Veraltet.Creates a new script helper instance.- Parameter:
ctx- The bundle context, must not benull.script- The script, must not benull.request- The request, may benull.response- The response, may benull.
-
-
Methodendetails
-
getScript
public org.apache.sling.api.scripting.SlingScript getScript()- Angegeben von:
getScriptin Schnittstelleorg.apache.sling.api.scripting.SlingScriptHelper- Siehe auch:
-
getJakartaRequest
public org.apache.sling.api.SlingJakartaHttpServletRequest getJakartaRequest()- Angegeben von:
getJakartaRequestin Schnittstelleorg.apache.sling.api.scripting.SlingScriptHelper- Siehe auch:
-
getJakartaResponse
public org.apache.sling.api.SlingJakartaHttpServletResponse getJakartaResponse()- Angegeben von:
getJakartaResponsein Schnittstelleorg.apache.sling.api.scripting.SlingScriptHelper- Siehe auch:
-
getRequest
public org.apache.sling.api.SlingHttpServletRequest getRequest()- Angegeben von:
getRequestin Schnittstelleorg.apache.sling.api.scripting.SlingScriptHelper- Siehe auch:
-
getResponse
public org.apache.sling.api.SlingHttpServletResponse getResponse()- Angegeben von:
getResponsein Schnittstelleorg.apache.sling.api.scripting.SlingScriptHelper- Siehe auch:
-
include
- Angegeben von:
includein Schnittstelleorg.apache.sling.api.scripting.SlingScriptHelper- Siehe auch:
-
include
- Angegeben von:
includein Schnittstelleorg.apache.sling.api.scripting.SlingScriptHelper- Siehe auch:
-
include
- Angegeben von:
includein Schnittstelleorg.apache.sling.api.scripting.SlingScriptHelper- Siehe auch:
-
forward
- Angegeben von:
forwardin Schnittstelleorg.apache.sling.api.scripting.SlingScriptHelper- Siehe auch:
-
forward
- Angegeben von:
forwardin Schnittstelleorg.apache.sling.api.scripting.SlingScriptHelper- Siehe auch:
-
forward
- Angegeben von:
forwardin Schnittstelleorg.apache.sling.api.scripting.SlingScriptHelper- Siehe auch:
-
dispose
Veraltet.This method is deprecated and should never be called by clients!- Angegeben von:
disposein Schnittstelleorg.apache.sling.api.scripting.SlingScriptHelper- Siehe auch:
-
getService
- Angegeben von:
getServicein Schnittstelleorg.apache.sling.api.scripting.SlingScriptHelper- Siehe auch:
-
getServices
public <T> T[] getServices(Class<T> serviceType, String filter) throws org.apache.sling.api.scripting.InvalidServiceFilterSyntaxException - Angegeben von:
getServicesin Schnittstelleorg.apache.sling.api.scripting.SlingScriptHelper- Löst aus:
org.apache.sling.api.scripting.InvalidServiceFilterSyntaxException- Siehe auch:
-
cleanup
public void cleanup()Clean up this instance. -
forward
public void forward(org.apache.sling.api.resource.Resource resource) - Angegeben von:
forwardin Schnittstelleorg.apache.sling.api.scripting.SlingScriptHelper- Siehe auch:
-
forward
- Angegeben von:
forwardin Schnittstelleorg.apache.sling.api.scripting.SlingScriptHelper- Siehe auch:
-
forward
public void forward(org.apache.sling.api.resource.Resource resource, org.apache.sling.api.request.RequestDispatcherOptions options) - Angegeben von:
forwardin Schnittstelleorg.apache.sling.api.scripting.SlingScriptHelper- Siehe auch:
-
include
public void include(org.apache.sling.api.resource.Resource resource) - Angegeben von:
includein Schnittstelleorg.apache.sling.api.scripting.SlingScriptHelper- Siehe auch:
-
include
- Angegeben von:
includein Schnittstelleorg.apache.sling.api.scripting.SlingScriptHelper- Siehe auch:
-
include
public void include(org.apache.sling.api.resource.Resource resource, org.apache.sling.api.request.RequestDispatcherOptions options) - Angegeben von:
includein Schnittstelleorg.apache.sling.api.scripting.SlingScriptHelper- Siehe auch:
-
ScriptHelper(BundleContext, SlingScript, SlingJakartaHttpServletRequest, SlingJakartaHttpServletResponse)