org.apache.struts2.ognl

## Class StrutsOgnlGuard

- java.lang.Object
- - org.apache.struts2.ognl.StrutsOgnlGuard

- All Implemented Interfaces:
    OgnlGuard

      public class StrutsOgnlGuard
      extends Object
      implements OgnlGuard

  The default implementation of `OgnlGuard`.
  Since:
    6.4.0

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Set<String>` | `excludedNodeTypes`

    - ### Fields inherited from interface org.apache.struts2.ognl.OgnlGuard

      `EXPR_BLOCKED`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StrutsOgnlGuard()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected boolean` | `checkNode(ognl.Node node)`
    `protected boolean` | `containsExcludedNodeType(ognl.Node node)`
    `boolean` | `isParsedTreeBlocked(Object tree)` Determines whether a parsed OGNL tree should be blocked based on some validation rules.
    `boolean` | `isRawExpressionBlocked(String expr)` Determines whether an OGNL expression should be blocked based on validation done on only the raw expression, without parsing the tree.
    `protected boolean` | `recurseNodes(ognl.Node node)`
    `protected boolean` | `skipTreeCheck(ognl.Node tree)`
    `void` | `useExcludedNodeTypes(String excludedNodeTypes)`
    `protected void` | `validateExcludedNodeTypes(Set<String> incomingExcludedNodeTypes)`

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

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

    - ### Methods inherited from interface org.apache.struts2.ognl.OgnlGuard

      `isBlocked, parseExpression`

- - ### Field Detail

    - #### excludedNodeTypes

          protected Set<String> excludedNodeTypes

  - ### Constructor Detail

    - #### StrutsOgnlGuard

          public StrutsOgnlGuard()

  - ### Method Detail

    - #### useExcludedNodeTypes

          public void useExcludedNodeTypes(String excludedNodeTypes)

    - #### validateExcludedNodeTypes

          protected void validateExcludedNodeTypes(Set<String> incomingExcludedNodeTypes)
                                            throws ConfigurationException

      Throws:
        `ConfigurationException`

    - #### isRawExpressionBlocked

          public boolean isRawExpressionBlocked(String expr)

      Description copied from interface: `OgnlGuard`
      Determines whether an OGNL expression should be blocked based on validation done on only the raw expression, without parsing the tree.
      Specified by:
        `isRawExpressionBlocked` in interface `OgnlGuard`
      Parameters:
        `expr` - OGNL expression
      Returns:
        whether the expression should be blocked

    - #### isParsedTreeBlocked

          public boolean isParsedTreeBlocked(Object tree)

      Description copied from interface: `OgnlGuard`
      Determines whether a parsed OGNL tree should be blocked based on some validation rules.
      Specified by:
        `isParsedTreeBlocked` in interface `OgnlGuard`
      Parameters:
        `tree` - parsed OGNL tree
      Returns:
        whether the parsed tree should be blocked

    - #### skipTreeCheck

          protected boolean skipTreeCheck(ognl.Node tree)

    - #### recurseNodes

          protected boolean recurseNodes(ognl.Node node)

    - #### checkNode

          protected boolean checkNode(ognl.Node node)

    - #### containsExcludedNodeType

          protected boolean containsExcludedNodeType(ognl.Node node)

Copyright © 2000–2026 Apache Software Foundation. All rights reserved.