How can I securely execute some user supplied JS code using Java8 Nashorn?  The script extends some computations for some servlet based reports. The app has many different (untrusted) users. The scripts should only be able to access a Java Object and...
I have a Java 7 program, that loads thousands of objects (components), each with many parameters (stored in a Map), and executes various Rhino scripts on those objects to calculate other derived parameters which get stored back in the object's Ma...
I'm attempting to filter a FreeMarker list in a Magnolia JavaScript model using Array.prototype.filter().  List  [#assign list = [1, 2, 3]]   Model  var Model = function() {   this.filterList = function(list) {     return list.filter(function(ite...
In Java 1.7, prior to it's removal, one could use 'Packages' to access Java Enums in the following way from Javascript on an HTML page viewed a browser:  var enumvar1 = document.appletid.Packages.com.mycompany.MyClass$MyEnumYesNo.YES var...
I need to evaluate this function in Javascript from Scala/Java  function hello(a, b) {     return a+b; }   I did this basic code:  val factory = new ScriptEngineManager(null) val engine = factory.getEngineByName("JavaScript")  val body =   &#...
I want to render d3 charts on the server.  I had 3 options:  Node, Phantom, and Nashorn.    I prefer Nashorn because my API is Scala Play and I don't want to manage another process.  (deployment, load, queue, etc etc)  So now I need to get JSDom...
I am trying to write a library that will let me execute JSON Logic rules via the Nashorn Javascript engine.  My problem right now is specifically around the JSObject wrapper I've created to handle moving data from Java/Kotlin into the scripting e...
In Java 7 (1.7), I could access a Java method from JavaScript by running this:  ScriptEngine jse = new ScriptEngineManager().getEngineByName("JavaScript"); jse.eval("importClass(net.apocalypselabs.symat.Functions);"); jse.eval("Sy...
I have evaluated the following script using the NashornScriptEngine:  var Namespace = {     test: function()     {         return "It works";     } }   Now I want to call the function test.  When using the method invokeFunction of the nashorn...
Java calling code:  import jdk.nashorn.api.scripting.*; .... myCustomHashMap dataStore = new myCustomHashMap(); ScriptEngineManager sem = new ScriptEngineManager(); ScriptEngine engine = sem.getEngineByName("nashorn"); engine.put("dataSto...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.