Package org.apache.struts2.ognl
Interface OgnlGuard
- All Known Implementing Classes:
StrutsOgnlGuard
public interface OgnlGuard
Guards all expressions parsed by Struts Core. It is evaluated by
OgnlUtil
immediately after parsing any
expression.- Since:
- 6.4.0
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
Determines whether an OGNL expression should be blocked based on validation done on both the raw expression and the parsed tree.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.default Object
parseExpression
(String expr) Parses an OGNL expression and returns the resulting tree only if the expression is not blocked as per defined validation rules inisRawExpressionBlocked(java.lang.String)
andisParsedTreeBlocked(java.lang.Object)
.
-
Field Details
-
EXPR_BLOCKED
- See Also:
-
-
Method Details
-
isBlocked
Determines whether an OGNL expression should be blocked based on validation done on both the raw expression and the parsed tree.- Parameters:
expr
- OGNL expression- Returns:
- whether the expression should be blocked
- Throws:
ognl.OgnlException
-
parseExpression
Parses an OGNL expression and returns the resulting tree only if the expression is not blocked as per defined validation rules inisRawExpressionBlocked(java.lang.String)
andisParsedTreeBlocked(java.lang.Object)
.- Parameters:
expr
- OGNL expression- Returns:
- parsed expression or
EXPR_BLOCKED
if the expression should be blocked - Throws:
ognl.OgnlException
-
isRawExpressionBlocked
Determines whether an OGNL expression should be blocked based on validation done on only the raw expression, without parsing the tree.- Parameters:
expr
- OGNL expression- Returns:
- whether the expression should be blocked
-
isParsedTreeBlocked
Determines whether a parsed OGNL tree should be blocked based on some validation rules.- Parameters:
tree
- parsed OGNL tree- Returns:
- whether the parsed tree should be blocked
-