Skip to content

Instantly share code, notes, and snippets.

@artem-smotrakov
Created February 17, 2021 12:22
Show Gist options
  • Save artem-smotrakov/5c8709fd6abe7f1a76be9d82fc838200 to your computer and use it in GitHub Desktop.
Save artem-smotrakov/5c8709fd6abe7f1a76be9d82fc838200 to your computer and use it in GitHub Desktop.
Run JEXL expressions in a sandbox implemented with JexlSandbox
JexlSandbox sandbox = new JexlSandbox(false);
sandbox.white("com.safe.Functions");
JexlEngine jexl = new JexlBuilder().sandbox(sandbox).create();
JexlExpression expression = jexl.createExpression(str);
JexlContext context = new MapContext();
expression.evaluate(context);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment