public class GroovySandbox extends Object
| Modifier and Type | Method and Description |
|---|---|
static org.codehaus.groovy.control.CompilerConfiguration |
createSecureCompilerConfiguration()
Prepares a compiler configuration the sandbox.
|
static void |
runInSandbox(Runnable r,
Whitelist whitelist)
Runs a block such as
GroovyShell.evaluate(String) in the sandbox. |
static void |
runInSandbox(groovy.lang.Script script,
Whitelist whitelist)
Runs a script in the sandbox.
|
@Nonnull public static org.codehaus.groovy.control.CompilerConfiguration createSecureCompilerConfiguration()
public static void runInSandbox(@Nonnull
Runnable r,
@Nonnull
Whitelist whitelist)
throws RejectedAccessException
GroovyShell.evaluate(String) in the sandbox.
You must have used createSecureCompilerConfiguration() to prepare the Groovy shell.r - a block of code during whose execution all calls are interceptedwhitelist - the whitelist to use, such as Whitelist.all()RejectedAccessException - in case an attempted call was not whitelistedpublic static void runInSandbox(@Nonnull
groovy.lang.Script script,
@Nonnull
Whitelist whitelist)
throws RejectedAccessException
createSecureCompilerConfiguration() to prepare the Groovy shell.script - a script ready to Script.run()whitelist - the whitelist to use, such as Whitelist.all()RejectedAccessException - in case an attempted call was not whitelistedCopyright © 2004-2014. All Rights Reserved.