|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.sling.scripting.core.ScriptHelper
public class ScriptHelper
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.
| Field Summary | |
|---|---|
protected org.osgi.framework.BundleContext |
bundleContext
|
protected java.util.List<org.osgi.framework.ServiceReference> |
references
The list of references - we don't need to synchronize this as we are running in one single request. |
protected java.util.Map<java.lang.String,java.lang.Object> |
services
A map of found services. |
| Constructor Summary | |
|---|---|
ScriptHelper(org.osgi.framework.BundleContext ctx,
SlingScript script)
|
|
ScriptHelper(org.osgi.framework.BundleContext ctx,
SlingScript script,
SlingHttpServletRequest request,
SlingHttpServletResponse response)
|
|
| Method Summary | ||
|---|---|---|
void |
dispose()
Dispose the helper. |
|
void |
forward(java.lang.String path)
Forward the request to another resource, using no options |
|
void |
forward(java.lang.String path,
RequestDispatcherOptions options)
Forward the request to another resource, using specified options |
|
void |
forward(java.lang.String path,
java.lang.String options)
Forward the request to another resource, using specified options |
|
SlingHttpServletRequest |
getRequest()
Returns the SlingHttpServletRequest representing the input of the
request. |
|
SlingHttpServletResponse |
getResponse()
Returns the SlingHttpServletResponse representing the output of
the request. |
|
SlingScript |
getScript()
Returns the SlingScript being called to handle the request. |
|
|
getService(java.lang.Class<ServiceType> type)
Lookup a single service |
|
|
getServices(java.lang.Class<ServiceType> serviceType,
java.lang.String filter)
Lookup one or several services |
|
void |
include(java.lang.String path)
Same as SlingScriptHelper.include(String,RequestDispatcherOptions), but using
empty options. |
|
void |
include(java.lang.String path,
RequestDispatcherOptions options)
Include the output of another request, using specified options |
|
void |
include(java.lang.String path,
java.lang.String options)
Include the output of another request, using specified options |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final org.osgi.framework.BundleContext bundleContext
protected final java.util.List<org.osgi.framework.ServiceReference> references
protected final java.util.Map<java.lang.String,java.lang.Object> services
| Constructor Detail |
|---|
public ScriptHelper(org.osgi.framework.BundleContext ctx,
SlingScript script)
public ScriptHelper(org.osgi.framework.BundleContext ctx,
SlingScript script,
SlingHttpServletRequest request,
SlingHttpServletResponse response)
| Method Detail |
|---|
public SlingScript getScript()
SlingScriptHelperSlingScript being called to handle the request.
getScript in interface SlingScriptHelperpublic SlingHttpServletRequest getRequest()
SlingScriptHelperSlingHttpServletRequest representing the input of the
request.
getRequest in interface SlingScriptHelperpublic SlingHttpServletResponse getResponse()
SlingScriptHelperSlingHttpServletResponse representing the output of
the request.
getResponse in interface SlingScriptHelperpublic void include(java.lang.String path)
SlingScriptHelperSlingScriptHelper.include(String,RequestDispatcherOptions), but using
empty options.
include in interface SlingScriptHelperSlingServletException - Wrapping a ServletException
thrown while handling the include.
public void include(java.lang.String path,
java.lang.String options)
include in interface SlingScriptHelperpath - The path to the resource to include.options - influence the rendering of the included
ResourceRequestDispatcherOptions.RequestDispatcherOptions(String),
SlingScriptHelper.include(String, RequestDispatcherOptions)
public void include(java.lang.String path,
RequestDispatcherOptions options)
include in interface SlingScriptHelperpath - The path to the resource to include.options - influence the rendering of the included ResourceRequestDispatcherOptions,
SlingScriptHelper.include(String, String)public void forward(java.lang.String path)
forward in interface SlingScriptHelper
public void forward(java.lang.String path,
java.lang.String options)
forward in interface SlingScriptHelperpath - The path to the resource to forward to.options - influence the rendering of the forwarded
ResourceRequestDispatcherOptions.RequestDispatcherOptions(String),
SlingScriptHelper.forward(String, RequestDispatcherOptions)
public void forward(java.lang.String path,
RequestDispatcherOptions options)
forward in interface SlingScriptHelperpath - The path to the resource to forward the request to.options - influence the rendering of the forwarded ResourceRequestDispatcherOptionspublic <ServiceType> ServiceType getService(java.lang.Class<ServiceType> type)
SlingScriptHelper
getService in interface SlingScriptHelpertype - The type (interface) of the service.
SlingScriptHelper.getService(java.lang.Class)
public <ServiceType> ServiceType[] getServices(java.lang.Class<ServiceType> serviceType,
java.lang.String filter)
throws InvalidServiceFilterSyntaxException
SlingScriptHelper
getServices in interface SlingScriptHelperserviceType - The type (interface) of the service.filter - An optional filter (LDAP-like, see OSGi spec)
InvalidServiceFilterSyntaxException - If the filter
string is not a valid OSGi service filter string.SlingScriptHelper.getServices(java.lang.Class, java.lang.String)public void dispose()
SlingScriptHelper
dispose in interface SlingScriptHelperSlingScriptHelper.dispose()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||