Class ThymeleafEvaluationContext
- All Implemented Interfaces:
org.springframework.expression.EvaluationContext,IThymeleafEvaluationContext
Thymeleaf's basic implementation of the IThymeleafEvaluationContext interface, which in turn extends
from Spring's EvaluationContext interface.
This implementation adds Thymeleaf's own property accessors
(see PropertyAccessor) for accessing
the IContext object in which variables are stored.
Also, this evaluation context (which is usually instanced at the
ThymeleafView initialization) links the execution of expressions
with the available BeanFactory and ConversionService instances, used during evaluation.
Before executing a Spring EL expression using this evaluation context, it should be enriched with the
variables to be made accessible (like #variableName), using a
ThymeleafEvaluationContextWrapper object.
- Since:
- 3.0.3
- Author:
- Daniel Fernández
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionThymeleafEvaluationContext(org.springframework.context.ApplicationContext applicationContext, org.springframework.core.convert.ConversionService conversionService) ThymeleafEvaluationContext(org.springframework.context.ApplicationContext applicationContext, org.springframework.core.convert.ConversionService conversionService, Collection<Class<?>> allowedClassOverridesForViews) -
Method Summary
Modifier and TypeMethodDescriptionCollection<Class<?>>Returns the classes that will be allowed to be used in SpEL expressions in views, explicitly overriding the standard set of forbidden classes.org.springframework.context.ApplicationContextorg.thymeleaf.expression.IExpressionObjectsbooleanlookupVariable(String name) voidsetExpressionObjects(org.thymeleaf.expression.IExpressionObjects expressionObjects) voidsetVariableAccessRestricted(boolean restricted) Methods inherited from class org.springframework.expression.spel.support.StandardEvaluationContext
addConstructorResolver, addIndexAccessor, addMethodResolver, addPropertyAccessor, applyDelegatesTo, getBeanResolver, getConstructorResolvers, getIndexAccessors, getMethodResolvers, getOperatorOverloader, getPropertyAccessors, getRootObject, getTypeComparator, getTypeConverter, getTypeLocator, registerFunction, registerFunction, registerMethodFilter, removeConstructorResolver, removeIndexAccessor, removeMethodResolver, removePropertyAccessor, setBeanResolver, setConstructorResolvers, setIndexAccessors, setMethodResolvers, setOperatorOverloader, setPropertyAccessors, setRootObject, setRootObject, setTypeComparator, setTypeConverter, setTypeLocator, setVariable, setVariablesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.expression.EvaluationContext
assignVariable, getBeanResolver, getConstructorResolvers, getIndexAccessors, getMethodResolvers, getOperatorOverloader, getPropertyAccessors, getRootObject, getTypeComparator, getTypeConverter, getTypeLocator, isAssignmentEnabled, setVariable
-
Field Details
-
THYMELEAF_EVALUATION_CONTEXT_CONTEXT_VARIABLE_NAME
- See Also:
-
-
Constructor Details
-
ThymeleafEvaluationContext
public ThymeleafEvaluationContext(org.springframework.context.ApplicationContext applicationContext, org.springframework.core.convert.ConversionService conversionService) -
ThymeleafEvaluationContext
public ThymeleafEvaluationContext(org.springframework.context.ApplicationContext applicationContext, org.springframework.core.convert.ConversionService conversionService, Collection<Class<?>> allowedClassOverridesForViews)
-
-
Method Details
-
getApplicationContext
public org.springframework.context.ApplicationContext getApplicationContext() -
getAllowedClassOverridesForViews
Returns the classes that will be allowed to be used in SpEL expressions in views, explicitly overriding the standard set of forbidden classes.
- Returns:
- the classes that will be allowed to be used in expressions in views even if forbidden by default.
- Since:
- 3.1.4
-
lookupVariable
- Specified by:
lookupVariablein interfaceorg.springframework.expression.EvaluationContext- Overrides:
lookupVariablein classorg.springframework.expression.spel.support.StandardEvaluationContext
-
isVariableAccessRestricted
public boolean isVariableAccessRestricted()- Specified by:
isVariableAccessRestrictedin interfaceIThymeleafEvaluationContext
-
setVariableAccessRestricted
public void setVariableAccessRestricted(boolean restricted) - Specified by:
setVariableAccessRestrictedin interfaceIThymeleafEvaluationContext
-
getExpressionObjects
public org.thymeleaf.expression.IExpressionObjects getExpressionObjects()- Specified by:
getExpressionObjectsin interfaceIThymeleafEvaluationContext
-
setExpressionObjects
public void setExpressionObjects(org.thymeleaf.expression.IExpressionObjects expressionObjects) - Specified by:
setExpressionObjectsin interfaceIThymeleafEvaluationContext
-