Better default handling for script selection
--------------------------------------------
Key: SLING-37
URL: https://issues.apache.org/jira/browse/SLING-37
Project: Sling
Issue Type: New Feature
Components: Scripting
Affects Versions: 2.0.0
Reporter: Felix Meschberger
Assignee: Felix Meschberger
Fix For: 2.0.0
Currently the ScriptedComponent analyzes the registered scripts and just falls
back to a default script called jsp/start.jsp. This default selection should be
extended such, that request selectors (see ComponentRequest.getSelectors())
contrubute to the script selection as follows:
- First apply all registered Script mappings of the ScriptedComponent
- Next use the request selectors to find a script below the scripted
component node
- If the second step does not resolve a script (or if no selectors exist)
just use the start.jsp script below the component node
The second step needs some more explanations: The selectors of the request are
joined with interleaving slashes to form a relative path. This path is appended
to the path of the scripted component and the name of script is assumed to be
start.jsp. If the path does not exist, trailing elements are just removed and
such a longest match is tried to be found.
Example:
(1) request for sample.html
No selectors exist, the start.jsp script below the component is used
(2) request for sample.image.gif
Selector is a single entry list [ image ]. First the script image/start.jsp is
checked, if that does not exist, the start.jsp is used.
(3) request for sample.image.80x80.gif
The selectors is a two-entry list [ image, 80x80 ]. The following scripts are
tested in order: image/80x80/start.jsp, image/start.jsp, start.jsp.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.