org.apache.sling.api.scripting
Interface SlingScriptResolver


public interface SlingScriptResolver

The ScriptResolver interface defines the API for a service capable of locating scripts. Where the script is actually located is an implementation detail of the service implementation.

Find scripts in the repository, based on the current Resource type. The script filename is built using the current HTTP request method name, followed by the extension of the current request and the desired script extension. For example, a "js" script for a GET request on a Resource of type some/type with request extension "html" should be stored as

      /sling/scripts/some/type/get.html.js
 
in the repository.

Applications of the Sling Framework generally do not need the servlet resolver as resolution of the servlets to process requests and sub-requests through a RequestDispatcher is handled by the Sling Framework.


Method Summary
 SlingScript findScript(ResourceResolver resourceResolver, java.lang.String name)
          Finds the given name to a SlingScript.
 

Method Detail

findScript

SlingScript findScript(ResourceResolver resourceResolver,
                       java.lang.String name)
Finds the given name to a SlingScript.

The semantic meaning of the name is implementation specific: It may be an absolute path to a Resource providing the script source or it may be a relative path resolved according to some path settings. Finally, the name may also just be used as an itentifier to find the script in some registry.

Parameters:
resourceResolver - The ResourceResolver used to access the script.
name - The script name. Must not be null.
Returns:
The SlingScript to which the name resolved or null otherwise.
Throws:
SlingException - If an error occurrs trying to resolve the name.


Copyright © 2007-2009. All Rights Reserved.