本文整理汇总了Java中org.thymeleaf.processor.ProcessorResult类的典型用法代码示例。如果您正苦于以下问题:Java ProcessorResult类的具体用法?Java ProcessorResult怎么用?Java ProcessorResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProcessorResult类属于org.thymeleaf.processor包,在下文中一共展示了ProcessorResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processElement
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
protected ProcessorResult processElement(Arguments arguments, Element element) {
StringBuffer sb = new StringBuffer();
sb.append("<SCRIPT>\n");
sb.append(" var params = \n ");
sb.append(buildContentMap(arguments)).append(";\n ");
sb.append(getUncacheableDataFunction(arguments, element)).append(";\n");
sb.append("</SCRIPT>");
// Add contentNode to the document
Node contentNode = new Macro(sb.toString());
element.clearChildren();
element.getParent().insertAfter(element, contentNode);
element.getParent().removeChild(element);
// Return OK
return ProcessorResult.OK;
}
示例2: processAttribute
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) {
HttpServletRequest request = ((IWebContext) arguments.getContext()).getHttpServletRequest();
Map<Option<?>, Object> stagingOptions = (Map<Option<?>, Object>) request
.getAttribute(DataTablesDialect.INTERNAL_BEAN_TABLE_STAGING_OPTIONS);
// Make the actual attribute processing
doProcessAttribute(arguments, element, attributeName, stagingOptions);
// Housekeeping
element.removeAttribute(attributeName);
return ProcessorResult.ok();
}
示例3: processAttribute
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) {
Map<Option<?>, Object> stagingOptions = (Map<Option<?>, Object>) arguments
.getLocalVariable(DataTablesDialect.INTERNAL_BEAN_COLUMN_STAGING_OPTIONS);
Map<Option<?>, Extension> stagingExtensions = (Map<Option<?>, Extension>) arguments
.getLocalVariable(DataTablesDialect.INTERNAL_BEAN_COLUMN_STAGING_EXTENSIONS);
// Perform the actual attribute processing
doProcessAttribute(arguments, element, attributeName, stagingOptions, stagingExtensions);
// Housekeeping
element.removeAttribute(attributeName);
return ProcessorResult.ok();
}
示例4: doProcessElement
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
protected ProcessorResult doProcessElement(Arguments arguments, Element element, HttpServletRequest request,
HttpServletResponse response, HtmlTable htmlTable) {
// The HtmlTable is updated with a new row
if (htmlTable != null) {
htmlTable.getBodyRows().add(new HtmlRow());
}
// Remove internal attribute
if (element.hasAttribute(DataTablesDialect.DIALECT_PREFIX + ":data")) {
element.removeAttribute(DataTablesDialect.DIALECT_PREFIX + ":data");
}
return ProcessorResult.OK;
}
示例5: processAttribute
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
protected ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) {
String[] value = element.getAttributeValue(attributeName).split(":");
String webjarName = value[0];
String filePath = value[1];
element.removeAttribute(attributeName);
element.setAttribute("th:" + attribute, String.format("@{/{path}/%s(path=${#webjars['%s'].path})}", filePath, webjarName));
// reevaluate th:src
element.setRecomputeProcessorsImmediately(true);
return ProcessorResult.OK;
}
示例6: processElement
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
/**
* This method will handle calling the modifyModelAttributes abstract method and return
* an "OK" processor result
*/
@Override
protected ProcessorResult processElement(final Arguments arguments, final Element element) {
modifyModelAttributes(arguments, element);
// Remove the tag from the DOM
final NestableNode parent = element.getParent();
parent.removeChild(element);
return ProcessorResult.OK;
}
示例7: processElement
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
protected ProcessorResult processElement(Arguments arguments, Element element) {
// If the form will be not be submitted with a GET, we must add the CSRF token
// We do this instead of checking for a POST because post is default if nothing is specified
if (!"GET".equalsIgnoreCase(element.getAttributeValueFromNormalizedName("method"))) {
try {
String csrfToken = eps.getCSRFToken();
//detect multipart form
if ("multipart/form-data".equalsIgnoreCase(element.getAttributeValueFromNormalizedName("enctype"))) {
Expression expression = (Expression) StandardExpressions.getExpressionParser(arguments.getConfiguration())
.parseExpression(arguments.getConfiguration(), arguments, element.getAttributeValueFromNormalizedName("th:action"));
String action = (String) expression.execute(arguments.getConfiguration(), arguments);
String csrfQueryParameter = "?" + eps.getCsrfTokenParameter() + "=" + csrfToken;
element.removeAttribute("th:action");
element.setAttribute("action", action + csrfQueryParameter);
} else {
Element csrfNode = new Element("input");
csrfNode.setAttribute("type", "hidden");
csrfNode.setAttribute("name", eps.getCsrfTokenParameter());
csrfNode.setAttribute("value", csrfToken);
element.addChild(csrfNode);
}
} catch (ServiceException e) {
throw new RuntimeException("Could not get a CSRF token for this session", e);
}
}
// Convert the <blc:form> node to a normal <form> node
Element newElement = element.cloneElementNodeWithNewName(element.getParent(), "form", false);
newElement.setRecomputeProcessorsImmediately(true);
element.getParent().insertAfter(element, newElement);
element.getParent().removeChild(element);
return ProcessorResult.OK;
}
示例8: processAttribute
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
protected ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) {
Expression expression = (Expression) StandardExpressions.getExpressionParser(arguments.getConfiguration())
.parseExpression(arguments.getConfiguration(), arguments, element.getAttributeValue(attributeName));
ProductOptionValue productOptionValue = (ProductOptionValue) expression.execute(arguments.getConfiguration(), arguments);
ProductOptionValueDTO dto = new ProductOptionValueDTO();
dto.setOptionId(productOptionValue.getProductOption().getId());
dto.setValueId(productOptionValue.getId());
dto.setValueName(productOptionValue.getAttributeValue());
if (productOptionValue.getPriceAdjustment() != null) {
dto.setPriceAdjustment(productOptionValue.getPriceAdjustment().getAmount());
}
try {
ObjectMapper mapper = new ObjectMapper();
Writer strWriter = new StringWriter();
mapper.writeValue(strWriter, dto);
element.setAttribute("data-product-option-value", strWriter.toString());
element.removeAttribute(attributeName);
return ProcessorResult.OK;
} catch (Exception ex) {
LOG.error("There was a problem writing the product option value to JSON", ex);
}
return null;
}
示例9: processAttribute
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
public ProcessorResult processAttribute(final Arguments arguments, final Element element, String attributeName) {
if (shouldCache(arguments, element, attributeName)) {
fixElement(element, arguments);
if (checkCacheForElement(arguments, element)) {
// This template has been cached.
element.clearChildren();
element.clearAttributes();
element.setRecomputeProcessorsImmediately(true);
}
}
return ProcessorResult.OK;
}
示例10: processAttribute
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
public ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) {
String parameters = element.getAttributeValue(attributeName);
element.removeAttribute(attributeName);
Map<String, Object> variables = new ParamsCommand(arguments, parameters).execute();
return ProcessorResult.setLocalVariables(variables);
}
示例11: processAttribute
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
public ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) {
String value = element.getAttributeValue(attributeName);
String query = ExpressionUtil.expressionValue(arguments, value).toString();
element.removeAttribute(attributeName);
Map<String, Object> variables = new QueryCommand(arguments, query).execute();
return ProcessorResult.setLocalVariables(variables);
}
示例12: processAttribute
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
public ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) {
String value = element.getAttributeValue(attributeName);
String query = ExpressionUtil.expressionValue(arguments, value).toString();
element.removeAttribute(attributeName);
Map<String, Object> variables = new UpdateCommand(arguments, query).execute();
return ProcessorResult.setLocalVariables(variables);
}
示例13: processAttribute
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
public ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) {
String properties = element.getAttributeValue(attributeName);
element.removeAttribute(attributeName);
new ConnectionCommand(arguments, properties).execute();
return ProcessorResult.OK;
}
示例14: processElement
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
@Override
protected ProcessorResult processElement(Arguments arguments, Element element) {
HttpServletRequest request = ((IWebContext) arguments.getContext()).getHttpServletRequest();
HttpServletResponse response = ((IWebContext) arguments.getContext()).getHttpServletResponse();
HtmlTable htmlTable = (HtmlTable) RequestUtils.getFromRequest(DataTablesDialect.INTERNAL_BEAN_TABLE, request);
ProcessorResult processorResult = doProcessElement(arguments, element, request, response, htmlTable);
return processorResult;
}
示例15: processAttribute
import org.thymeleaf.processor.ProcessorResult; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
protected ProcessorResult processAttribute(Arguments arguments, Element element, String attributeName) {
HttpServletRequest request = ((IWebContext) arguments.getContext()).getHttpServletRequest();
// A Map<ConfType, Object> is associated with each table id
Map<String, Map<ConfType, Object>> configs = (Map<String, Map<ConfType, Object>>) RequestUtils.getFromRequest(
DataTablesDialect.INTERNAL_BEAN_CONFIGS, request);
String tableId = AttributeUtils.parseStringAttribute(arguments, element, attributeName);
if (configs != null && configs.containsKey(tableId)) {
throw new DandelionException("A div with id '" + tableId + "' is already present in the current template.");
}
else {
configs = new HashMap<String, Map<ConfType, Object>>();
}
configs.put(tableId, new HashMap<ConfType, Object>());
RequestUtils.storeInRequest(DataTablesDialect.INTERNAL_BEAN_CONFIGS, configs, request);
// The node is stored to be easily accessed later during the processing
RequestUtils.storeInRequest(DataTablesDialect.INTERNAL_NODE_CONFIG, element, request);
return ProcessorResult.ok();
}