On Fri, Jan 23, 2015 at 1:15 PM, Bertrand Delacretaz <[email protected]
> wrote:

> Good point - we can consider that notation say anywhere in the first
> 200 chars of the script, so
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!-- sling:language: thymeleaf -->
> <foo/>
>
> would work, the pattern being "sling:language" followed by whitespace
> and one word which is the language name.
>

This has the disadvantage that the Servlet Resolver would have to parse the
first n characters of the script and then the Script Engine would parse
again the whole file. We should not increase the number of resource reads,
if not really needed.

If we want to have a conflict resolution mechanism we could add a property
on component nodes (but they must be sling:Folder / nt:unstructured) that
would handle which of the multiple scripting engines registered for the
same extension should be used:

"sling:script" -> "html:thymeleaf"

This would essentially say that for the *.html scripts for this component,
Thymeleaf should be used.

However, this adds an unnecessary step for component developers. I think
the configurable patterns on the ScriptEngineFactories is simpler, as this
is essentially a deployment issue.

Whatever the approach is, if we want to allow multiple scripting engines to
use the same extension we need to refactor the code from the
SlingScriptEngineManager.

Reply via email to