Package org.apache.nutch.util
Class JexlUtil
java.lang.Object
org.apache.nutch.util.JexlUtil
Utility methods for handling JEXL expressions used in crawl and index
pipelines. Expressions are evaluated under a
JexlSandbox with
JexlFeatures.newInstance(boolean) disabled so arbitrary classes cannot
be instantiated from user-supplied configuration.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringWhentrue, JEXL parsing skips the sandbox (unsafe). -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.commons.jexl3.JexlScriptparseExpression(String expr) Parses a JEXL expression using the default (sandboxed) engine.static org.apache.commons.jexl3.JexlScriptparseExpression(Configuration conf, String expr) Parses a JEXL expression.
-
Field Details
-
DISABLE_SANDBOX_KEY
Whentrue, JEXL parsing skips the sandbox (unsafe). For trusted environments only; not recommended.- See Also:
-
-
Method Details
-
parseExpression
Parses a JEXL expression using the default (sandboxed) engine. UseparseExpression(Configuration, String)when aConfigurationis available soDISABLE_SANDBOX_KEYcan be honored.- Parameters:
expr- string JEXL expression- Returns:
- parsed JEXL expression or null in case of parse error
-
parseExpression
Parses a JEXL expression. UnlessDISABLE_SANDBOX_KEYis set totrueinconf, the expression is parsed for execution under a restrictive sandbox.- Parameters:
conf- Hadoop configuration, or null to always use the sandboxexpr- string JEXL expression- Returns:
- parsed JEXL expression or null in case of parse error
-