[
https://issues.apache.org/jira/browse/SLING-4801?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Radu Cotescu resolved SLING-4801.
---------------------------------
Resolution: Later
Fix Version/s: (was: Scripting JavaScript 2.0.18)
> Add support for Nashorn in the JavaScript Scripting Engine
> ----------------------------------------------------------
>
> Key: SLING-4801
> URL: https://issues.apache.org/jira/browse/SLING-4801
> Project: Sling
> Issue Type: Improvement
> Components: Scripting
> Affects Versions: Scripting JavaScript 2.0.16
> Reporter: Radu Cotescu
> Assignee: Radu Cotescu
> Attachments: SLING-4801.patch
>
>
> The {{org.apache.sling.scripting.javascript}} bundle should attempt to use
> Nashorn, if available on the user's platform, for running JS code.
> Alternatively it should switch to Rhino if the JRE is < 1.8.
> Requirements:
> * need to expose the
> {{jdk.nashorn.api.scripting;version="0.0.0.1_008_JavaSE"}} package on JRE >=
> 1.8 in Sling's {{launchpad/base/src/main/resources/jre-1.8.properties}}
> properties files
> * the Rhino and Nashorn implementations need to co-exist, so that customers
> still running on Java < 8 can use the Rhino implementation; the switch from
> Rhino to Nashorn should happen automatically but should also be made
> configurable in case customers really want to use a specific implementation;
> while the Nashorn implementation requires Java 8 (and this can easily be
> handled through the {{Require-Capability}} \[0\] and
> {{Bundle-RequiredExecutionEnvironment}} \[1\] manifest headers) and the
> bundle implementing Nashorn support won't start if the detected Java version
> is < 8, a non-sticky run mode / configuration should handle the switch if
> customers would still like to use the Rhino implementation on Java >= 8
> * need to find a way to inject custom properties to all instances of a class,
> similar to Rhino's host objects \[2\] (thread open on Nashorn's dev list at
> \[3\]); this is needed in order to assure JavaScript API backwards
> compatibility with the JS API exposed through the Rhino implementation
> currently available in {{org.apache.sling.scripting.javascript}}; it seems
> that Nashorn's public API only allows proxying an object, not all instances
> of a class
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)