Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Name

Description

request

SlingHttpServletRequest object, providing access to the HTTP request header information - extends the standard HttpServletRequest - but also provides access to Sling-specific things like resource, selectorspath info, selector, etc.

response

SlingHttpServletResponse object, providing access for the HTTP response that is created by the server. This is currently the same as the HttpServletResponse from which it extends.

sling

SlingScriptHelper, containing convenience methods for scripts, mainly sling.include('/some/other/resource') for including the responses of other resources inside this response (eg. embedding header html snippets) and sling.getService(foo.bar.Service.class) to retrieve OSGi services available in Sling (Class notation depending on scripting language).

resource

Current Resource to handle, depending on the URL of the request. Same as request.getResource().

currentNode

If the current resource points to a JCR node (which is typically the case in Sling), this gives you direct access to the Node object. Otherwise this object is not defined.

reader

Direct access to the Reader of the request - same as request.getReader(). Use it for reading the data of an HTTP request body.

out

Direct access to the PrintWriter of the response - same as response.getWriter(). Use it for writing to the HTTP response body.

flush

Indicates whether the output used by the script shall be flushed after the script evaluation ended. It is a Boolean, so use TRUE for flushing or FALSE for not flushing, which is the default value. The boolean value notation depends on the scripting language.

log

Provides an SLF4J Logger for logging to the Sling log system from within scripts, eg. log.info("Executing my script").

...