Package org.apache.nutch.util

# Class JexlUtil

java.lang.Object
org.apache.nutch.util.JexlUtil

public class JexlUtil extends Object
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

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `DISABLE_SANDBOX_KEY`
  When `true`, JEXL parsing skips the sandbox (unsafe).

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static org.apache.commons.jexl3.JexlScript`
  `parseExpression(String expr)`
  Parses a JEXL expression using the default (sandboxed) engine.
  `static org.apache.commons.jexl3.JexlScript`
  `parseExpression(Configuration conf, String expr)`
  Parses a JEXL expression.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### DISABLE_SANDBOX_KEY

    public static final String DISABLE_SANDBOX_KEY
    When `true`, JEXL parsing skips the sandbox (unsafe). For trusted environments only; not recommended.
    See Also:
      - Constant Field Values

- ## Method Details

  - ### parseExpression

    public static org.apache.commons.jexl3.JexlScript parseExpression(String expr)
    Parses a JEXL expression using the default (sandboxed) engine. Use `parseExpression(Configuration, String)` when a `Configuration` is available so `DISABLE_SANDBOX_KEY` can be honored.
    Parameters:
      `expr` - string JEXL expression
    Returns:
      parsed JEXL expression or null in case of parse error

  - ### parseExpression

    public static org.apache.commons.jexl3.JexlScript parseExpression(Configuration conf, String expr)
    Parses a JEXL expression. Unless `DISABLE_SANDBOX_KEY` is set to `true` in `conf`, the expression is parsed for execution under a restrictive sandbox.
    Parameters:
      `conf` - Hadoop configuration, or null to always use the sandbox
      `expr` - string JEXL expression
    Returns:
      parsed JEXL expression or null in case of parse error