import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.thymeleaf.context.IContext;
+import org.thymeleaf.context.ITemplateContext;
+import org.thymeleaf.engine.AttributeName;
+import org.thymeleaf.engine.EngineEventUtils;
import org.thymeleaf.exceptions.TemplateProcessingException;
+import org.thymeleaf.model.IModel;
+import org.thymeleaf.model.IProcessableElementTag;
import org.thymeleaf.processor.element.AbstractAttributeModelProcessor;
+import org.thymeleaf.processor.element.IElementModelStructureHandler;
import org.thymeleaf.standard.expression.IStandardExpression;
import org.thymeleaf.standard.expression.IStandardExpressionParser;
import org.thymeleaf.standard.expression.StandardExpressions;
@Override
- public final ProcessorResult processAttribute(
- final Arguments arguments,
- final Element element,
- final String name
+ protected void doProcess(
+ final ITemplateContext context,
+ final IModel model,
+ final AttributeName attributeName,
+ final String attributeValue,
+ final IElementModelStructureHandler handler
)
{
- Configuration config = arguments.getConfiguration();
-
- Configuration configuration = arguments.getConfiguration();
-
- String parameter = element.getAttributeValue(name);
- try
- {
- IStandardExpressionParser parser =
- StandardExpressions.getExpressionParser(configuration);
- IStandardExpression expression =
- parser.parseExpression(configuration, arguments, parameter);
- parameter = (String)expression.execute(configuration, arguments);
- }
- catch (TemplateProcessingException e) { }
+ final IProcessableElementTag element = (IProcessableElementTag) model.get(0);
+ final String parameter =
+ EngineEventUtils.computeAttributeExpression(
+ context,
+ element,
+ attributeName,
+ attributeValue
+ )
+ .execute(context).toString();
if (parameter != null && !parameter.trim().isEmpty())
{
LOG.info("ignoring empty parameter");
- return ProcessorResult.OK;
+ return;
}
Iterator<Entry<String, Object>> it = null;