[
https://issues.apache.org/jira/browse/SLING-4330?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16932391#comment-16932391
]
Oliver Lietz commented on SLING-4330:
-------------------------------------
[~radu.cotescu], Moving {{SlingScriptEnginePicker}} to
{{SlingScriptEngineManager}} is fine for me but we should consider the domains:
{{SlingScriptAdapterFactory}} is Sling ({{Resource}} API) and
{{[ScriptEngineManager|https://docs.oracle.com/javase/8/docs/api/javax/script/ScriptEngineManager.html]}}
is Java Scripting API (JSR 223)
{{SlingScriptEngineManager}} extends {{ScriptEngineManager}} and is only
exposed as {{ScriptEngineManager}}. The API of {{ScriptEngineManager}} is quite
poor and IMHO at least a method {{#getEngineByLanguage(String name, String
version):ScriptEngine}} is missing (see also TODO in
{{SlingScriptEnginePicker}} and {{Conditions}}).
In Scripting Thymeleaf we register the {{TemplateEngine}} as service
{{ITemplateEngine}} – so there are already ways to get template and script
engines for different use cases.
Can you describe the uses cases you have in mind?
How do you want to map a resource type to a script engine?
> Select script engines in SlingScriptAdapterFactory via mapping
> --------------------------------------------------------------
>
> Key: SLING-4330
> URL: https://issues.apache.org/jira/browse/SLING-4330
> Project: Sling
> Issue Type: New Feature
> Components: Scripting
> Affects Versions: Scripting Core 2.0.28
> Reporter: Oliver Lietz
> Assignee: Oliver Lietz
> Priority: Major
> Fix For: Scripting Core 2.0.60
>
>
> Running multiple script engines for same script (template) extension should
> be possible.
> -Scripting Thymeleaf already provides that parameter, see
> {{org.apache.sling.scripting.thymeleaf.SlingTemplateModeHandler#getPatternSpec():org.thymeleaf.PatternSpec}}.-
> Support for multiple script engines via mapping:
> {noformat}
> {
> "sling:scripting": [
> "html=The HTL Templating Language:1.4",
> "js=ECMAScript:partial ECMAScript 2015 support"
> ]
> }
> {noformat}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)