Skip to main content

javax.script - javascript, ImporterTopLevel

No replies
Joined: 2005-05-12
Points: 0

I have a program that uses Rhino to offer the user scripting features. I don't want the user to have access to the 'print' or 'importPackage', because I want to keep the user from reaching the system. I provide custom functions, using 'defineFunction' on 'ScriptableObject'.

However, with the javax.script thing I seem to lose control over things like that. The javascript (Rhino) I get from javax.script always has 'print' and 'importPackage'.

1) how can I use javax.script without giving the user 'importPackage' and 'print' ?
2) how can I add custom functions ? ps. Without adding special code in the javascript.