Chris, On 18.02.2021 15:56, Christopher Schultz wrote: ... cut ... > A BSF / JSR-233 environment that is available for any servlet container would > certainly be an > accomplishment, and probably very useful for some shops (and students!). > > I wonder if there is anything we can learn / steal from Apache Sling.
hmm, at first sight Apache Sling defines its own Scripting classes [1] and seems to not use JSR-223 [2, 3] (or BSF [4] for that matter). As a result it seems that each scripting language that you wish to use in the Sling environment needs to get a proper SlingScript implementation otherwise you are out of luck. Personally I think one should adhere to the standard Java scripting framework [2] whenever possible (and I would see no compelling reason at first sight why the Sling project created its own scripting framework). The Java scripting framework allows non-Java programmers to create scripts that can be deployed by the Java application and allow them to interact directly with explicitly supplied Java objects of the Java application. Loading a scripting language for the Java application programmer is as easy as using javax.script.ScriptEngineManager methods that start with getEngineBy...() supplying the name of the scripting language (like "groovy", "javascript", "netrexx", "rexx" and the like), one of its mime-types or one of its file-extensions and then (re-)using that engine to evaluate script code. The JSR-223 [3] implementation of Java 6 makes it also quite easy to create new bindings for new programming languages (one merely needs to extend javax.script.AbstractScriptEngine, which implements already most of the javax.script.ScriptEngine interface, and implement the javax.script.ScriptFactory interface). ---rony [1] Sling's Scripting Framework: <https://sling.apache.org/apidocs/sling10/org/apache/sling/api/scripting/package-summary.html> [2] Java's Scripting Framework (Since Java 6): <https://docs.oracle.com/javase/8/docs/api/index.html?javax/script/package-summary.html> [3] JCP JSR-223: <https://www.jcp.org/en/jsr/detail?id=223> [4] Apache BSF: <https://commons.apache.org/proper/commons-bsf/> --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org