• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Configuration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.thymeleaf.Configuration的典型用法代码示例。如果您正苦于以下问题:Java Configuration类的具体用法?Java Configuration怎么用?Java Configuration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Configuration类属于org.thymeleaf包,在下文中一共展示了Configuration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: parse

import org.thymeleaf.Configuration; //导入依赖的package包/类
public static Object parse(final Arguments arguments, final String attributeValue, boolean escape) {

        final Configuration configuration = arguments.getConfiguration();
        final IStandardExpressionParser expressionParser = StandardExpressions.getExpressionParser(configuration);

        final IStandardExpression expression = expressionParser.parseExpression(configuration, arguments, attributeValue);

        final Object result;
        if (escape) {
            result = expression.execute(configuration, arguments);
        }
        else {
            result = expression.execute(configuration, arguments, StandardExpressionExecutionContext.UNESCAPED_EXPRESSION);
        }

        return result;
    }
 
开发者ID:af-not-found,项目名称:blog-java2,代码行数:18,代码来源:ProcessorUtil.java


示例2: isVisible

import org.thymeleaf.Configuration; //导入依赖的package包/类
@Override
protected boolean isVisible(final Arguments arguments, final Element element, final String attributeName) {

    String attributeValue = element.getAttributeValue(attributeName);

    if (StringUtils.indexOf(attributeValue, "isAdminPage") != -1) {
        Object context = arguments.getContext();
        if (context instanceof SpringWebContext) {
            SpringWebContext webContext = (SpringWebContext) context;
            HttpServletRequest httpServletRequest = webContext.getHttpServletRequest();
            boolean val = StringUtils.indexOf(httpServletRequest.getRequestURI(), "/_admin/") != -1;
            attributeValue = StringUtils.replace(attributeValue, "isAdminPage", Boolean.toString(val));
        }
    }

    final Configuration configuration = arguments.getConfiguration();
    final IStandardExpressionParser expressionParser = StandardExpressions.getExpressionParser(configuration);

    final IStandardExpression expression = expressionParser.parseExpression(configuration, arguments, attributeValue);
    final Object value = expression.execute(configuration, arguments);

    final boolean visible = EvaluationUtil.evaluateAsBoolean(value);

    return visible;
}
 
开发者ID:af-not-found,项目名称:blog-java2,代码行数:26,代码来源:MyFunctionDialect.java


示例3: getModifiedAttributeValues

import org.thymeleaf.Configuration; //导入依赖的package包/类
@Override
protected Map<String, String> getModifiedAttributeValues(
        Arguments arguments, Element element, String attributeName) {
    final String attributeValue = element.getAttributeValue(attributeName);

    final Configuration configuration = arguments.getConfiguration();
    final IStandardExpressionParser expressionParser =
            StandardExpressions.getExpressionParser(configuration);

    final IStandardExpression expression =
            expressionParser.parseExpression(configuration, arguments, attributeValue);

    final Set<String> newAttributeNames =
            new HashSet<String>(Arrays.asList("id", "name"));

    final Object valueForAttributes = expression.execute(configuration, arguments);

    final Map<String,String> result =
            new HashMap<String,String>(newAttributeNames.size() + 1, 1.0f);
    for (final String newAttributeName : newAttributeNames) {
        result.put(newAttributeName,
                (valueForAttributes == null? "" : valueForAttributes.toString()));
    }

    return result;
}
 
开发者ID:onBass-naga,项目名称:spring-boot-samples,代码行数:27,代码来源:IdNameProcessor.java


示例4: parseExpression

import org.thymeleaf.Configuration; //导入依赖的package包/类
static IStandardExpression parseExpression(final Configuration configuration,
      final IProcessingContext processingContext, final String input, final boolean preprocess) {

   final String preprocessedInput = (preprocess ? StandardExpressionPreprocessor.preprocess(configuration,
         processingContext, input) : input);

   if (configuration != null) {
      final IStandardExpression cachedExpression = ExpressionCache.getExpressionFromCache(configuration,
            preprocessedInput);
      if (cachedExpression != null) {
         return cachedExpression;
      }
   }

   final Expression expression = Expression.parse(preprocessedInput.trim());

   // No exception is thrown if the expression is null because we need to
   // catch it elsewhere

   return expression;

}
 
开发者ID:dandelion,项目名称:dandelion-datatables,代码行数:23,代码来源:StandardExpressionParserWrapper.java


示例5: processStandardExpression

import org.thymeleaf.Configuration; //导入依赖的package包/类
/**
 * <p>
 * Processes the provided value using the Thymeleaf Standard Expression
 * processor.
 * </p>
 * 
 * @param arguments
 *           Thymeleaf {@link Arguments}
 * @param value
 *           String expression to parse
 * @param clazz
 *           {@link Class} of the attribute's value
 * @return an object processed by the Thymeleaf Standard Expression
 *         processor.
 */
@SuppressWarnings("unchecked")
private static <T> T processStandardExpression(Arguments arguments, String value, Class<T> clazz) {

   Object result = null;

   Configuration configuration = arguments.getConfiguration();
   StandardExpressionParserWrapper expressionParser = new StandardExpressionParserWrapper();
   IStandardExpression standardExpression = expressionParser.parseExpression(configuration, arguments, value);

   if (standardExpression == null) {
      result = value;
   }
   else {
      result = standardExpression.execute(configuration, arguments);
   }

   // Handling null value
   if (result == null) {
      return null;
   }

   return clazz.isAssignableFrom(result.getClass()) ? (T) result : null;
}
 
开发者ID:dandelion,项目名称:dandelion-datatables,代码行数:39,代码来源:AttributeUtils.java


示例6: getProcessedAttribute

import org.thymeleaf.Configuration; //导入依赖的package包/类
private static Object getProcessedAttribute(Arguments arguments, String value) {

      Object result = null;

      Configuration configuration = arguments.getConfiguration();
      StandardExpressionParserWrapper expressionParser = new StandardExpressionParserWrapper();
      IStandardExpression standardExpression = expressionParser.parseExpression(configuration, arguments, value);

      if (standardExpression == null) {
         result = value;
      }
      else {
         result = standardExpression.execute(configuration, arguments);
      }

      return result;
   }
 
开发者ID:dandelion,项目名称:dandelion-datatables,代码行数:18,代码来源:AttributeUtils.java


示例7: BaseThymeleafNarrativeGenerator

import org.thymeleaf.Configuration; //导入依赖的package包/类
public BaseThymeleafNarrativeGenerator() {
	myThymeleafConfig = new Configuration();
	myThymeleafConfig.addTemplateResolver(new ClassLoaderTemplateResolver());
	myThymeleafConfig.addMessageResolver(new StandardMessageResolver());
	myThymeleafConfig.setTemplateModeHandlers(StandardTemplateModeHandlers.ALL_TEMPLATE_MODE_HANDLERS);
	myThymeleafConfig.initialize();
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:8,代码来源:BaseThymeleafNarrativeGenerator.java


示例8: getXhtmlDOMFor

import org.thymeleaf.Configuration; //导入依赖的package包/类
private Document getXhtmlDOMFor(final Reader source) {
	final Configuration configuration1 = myThymeleafConfig;
	try {
		return PARSER.parseTemplate(configuration1, "input", source);
	} catch (final Exception e) {
		throw new TemplateInputException("Exception during parsing of source", e);
	}
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:9,代码来源:BaseThymeleafNarrativeGenerator.java


示例9: testGetRowsFromRequestParams

import org.thymeleaf.Configuration; //导入依赖的package包/类
@Test
public void testGetRowsFromRequestParams() throws Exception {
   Expression qTime = Expression.parse("${params.rows}");
   assertEquals("42", Expression.execute(new Configuration(), new ProcessingContext(context), qTime,
         new OgnlVariableExpressionEvaluator(), StandardExpressionExecutionContext.NORMAL));

}
 
开发者ID:shopping24,项目名称:solr-thymeleaf,代码行数:8,代码来源:SolrExpressionTest.java


示例10: parseTemplate

import org.thymeleaf.Configuration; //导入依赖的package包/类
public Document parseTemplate(Configuration configuration,
		String documentName, Reader source) {
	Document doc = decoratedParser.parseTemplate(configuration, documentName, source);
	try {
		preprocessor.preProcess(documentName, doc);
	} catch (IOException e) {
		throw new UnsupportedOperationException(e.getMessage(), e);
	}
	return doc;
}
 
开发者ID:connect-group,项目名称:thymesheet,代码行数:11,代码来源:ThymesheetTemplateParser.java


示例11: AntonBugTest

import org.thymeleaf.Configuration; //导入依赖的package包/类
public AntonBugTest() throws Exception {
	
	XmlNonValidatingSAXTemplateParser parser = new XmlNonValidatingSAXTemplateParser(1);
	Reader reader = new InputStreamReader(getClass().getResourceAsStream("/selector/anton-bug.xml"));
	Configuration configuration = new Configuration();
	configuration.setTemplateResolver(new UrlTemplateResolver());
	configuration.setMessageResolver(new StandardMessageResolver());
	configuration.setDefaultTemplateModeHandlers(StandardTemplateModeHandlers.ALL_TEMPLATE_MODE_HANDLERS);
	configuration.initialize();
	Document document = parser.parseTemplate(configuration, "anton-bug", reader);
    nodeSelector = new DOMNodeSelector(document);
}
 
开发者ID:connect-group,项目名称:thymesheet,代码行数:13,代码来源:AntonBugTest.java


示例12: DOMNodeSelectorTest

import org.thymeleaf.Configuration; //导入依赖的package包/类
public DOMNodeSelectorTest() throws Exception {
	XmlNonValidatingSAXTemplateParser parser = new XmlNonValidatingSAXTemplateParser(1);
	Reader reader = new InputStreamReader(getClass().getResourceAsStream("/selector/test.html"));
	Configuration configuration = new Configuration();
	configuration.setTemplateResolver(new UrlTemplateResolver());
	configuration.setMessageResolver(new StandardMessageResolver());
	configuration.setDefaultTemplateModeHandlers(StandardTemplateModeHandlers.ALL_TEMPLATE_MODE_HANDLERS);
	configuration.initialize();
	Document document = parser.parseTemplate(configuration, "test", reader);
    nodeSelector = new DOMNodeSelector(document);     
}
 
开发者ID:connect-group,项目名称:thymesheet,代码行数:12,代码来源:DOMNodeSelectorTest.java


示例13: MyFields

import org.thymeleaf.Configuration; //导入依赖的package包/类
public MyFields(final Configuration configuration,
                final IProcessingContext processingContext) {
    super();
    this.configuration = configuration;
    this.processingContext = processingContext;
}
 
开发者ID:onBass-naga,项目名称:spring-boot-samples,代码行数:7,代码来源:MyFields.java


示例14: MyDialect

import org.thymeleaf.Configuration; //导入依赖的package包/类
public MyDialect(Configuration configuration) {
    super();
    this.configuration = configuration;
}
 
开发者ID:onBass-naga,项目名称:spring-boot-samples,代码行数:5,代码来源:MyDialect.java


示例15: processAttribute

import org.thymeleaf.Configuration; //导入依赖的package包/类
@Override
protected ProcessorResult processAttribute(Arguments theArguments, Element theElement, String theAttributeName) {
	final String attributeValue = theElement.getAttributeValue(theAttributeName);

	final Configuration configuration = theArguments.getConfiguration();
	final IStandardExpressionParser expressionParser = StandardExpressions.getExpressionParser(configuration);

	final IStandardExpression expression = expressionParser.parseExpression(configuration, theArguments, attributeValue);
	final Object value = expression.execute(configuration, theArguments);

	theElement.removeAttribute(theAttributeName);
	theElement.clearChildren();

	if (value == null) {
		return ProcessorResult.ok();
	}

	Context context = new Context();
	context.setVariable("resource", value);

	String name = null;
	if (value != null) {
		Class<? extends Object> nextClass = value.getClass();
		do {
			name = myClassToName.get(nextClass);
			nextClass = nextClass.getSuperclass();
		} while (name == null && nextClass.equals(Object.class) == false);
		
		if (name == null) {
			if (value instanceof IBaseResource) {
				name = myFhirContext.getResourceDefinition((IBaseResource)value).getName();
			} else if (value instanceof IDatatype) {
				name = value.getClass().getSimpleName();
				name = name.substring(0, name.length() - 2);
			} else {
				throw new DataFormatException("Don't know how to determine name for type: " + value.getClass());
			}
			name = name.toLowerCase();
			if (!myNameToNarrativeTemplate.containsKey(name)) {
				name = null;
			}
		}
	}

	if (name == null) {
		if (myIgnoreMissingTemplates) {
			ourLog.debug("No narrative template available for type: {}", value.getClass());
			return ProcessorResult.ok();
		} else {
			throw new DataFormatException("No narrative template for class " + value.getClass());
		}
	}

	String result = myProfileTemplateEngine.process(name, context);
	String trim = result.trim();
	if (!isBlank(trim + "AAA")) {
		Document dom = getXhtmlDOMFor(new StringReader(trim));
		
		Element firstChild = (Element) dom.getFirstChild();
		for (int i = 0; i < firstChild.getChildren().size(); i++) {
			Node next = firstChild.getChildren().get(i);
			if (i == 0 && firstChild.getChildren().size() == 1) {
				if (next instanceof org.thymeleaf.dom.Text) {
					org.thymeleaf.dom.Text nextText = (org.thymeleaf.dom.Text) next;
					nextText.setContent(nextText.getContent().trim());
				}
			}
			theElement.addChild(next);
		}
		
	}
	

	return ProcessorResult.ok();
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:76,代码来源:BaseThymeleafNarrativeGenerator.java


示例16: evaluate

import org.thymeleaf.Configuration; //导入依赖的package包/类
private static Object evaluate(Arguments arguments, String expression) {
    Configuration configuration = arguments.getConfiguration();
    IStandardExpressionParser expressionParser = StandardExpressions.getExpressionParser(configuration);
    IStandardExpression standardExpression = expressionParser.parseExpression(configuration, arguments, expression);
    return standardExpression.execute(configuration, arguments);
}
 
开发者ID:jmiguelsamper,项目名称:thymeleaf-extras-sqldialect,代码行数:7,代码来源:ExpressionUtil.java


示例17: testGetQueryTime

import org.thymeleaf.Configuration; //导入依赖的package包/类
@Test
public void testGetQueryTime() throws Exception {
   Expression qTime = Expression.parse("${response.QTime}");
   assertEquals(667,Expression.execute(new Configuration(), new ProcessingContext(context), qTime,
         new OgnlVariableExpressionEvaluator(), StandardExpressionExecutionContext.NORMAL));
}
 
开发者ID:shopping24,项目名称:solr-thymeleaf,代码行数:7,代码来源:SolrExpressionTest.java


示例18: testVariables

import org.thymeleaf.Configuration; //导入依赖的package包/类
@Test
public void testVariables() throws Exception {
   Expression corename = Expression.parse("${solr_core_name}");
   assertEquals("some-core", Expression.execute(new Configuration(), new ProcessingContext(context), corename,
         new OgnlVariableExpressionEvaluator(), StandardExpressionExecutionContext.NORMAL));
}
 
开发者ID:shopping24,项目名称:solr-thymeleaf,代码行数:7,代码来源:SolrExpressionTest.java


示例19: parseFragment

import org.thymeleaf.Configuration; //导入依赖的package包/类
public List<Node> parseFragment(Configuration configuration, String fragment) {
	return decoratedParser.parseFragment(configuration, fragment);
}
 
开发者ID:connect-group,项目名称:thymesheet,代码行数:4,代码来源:ThymesheetTemplateParser.java


示例20: parseAssignationSequence

import org.thymeleaf.Configuration; //导入依赖的package包/类
/**
 * 
 * @param configuration
 *           configuration
 * @param processingContext
 *           processingContext
 * @param input
 *           input
 * @param allowParametersWithoutValue
 *           allowParametersWithoutValue
 * @return the result
 * @since 2.0.9
 */
public AssignationSequence parseAssignationSequence(final Configuration configuration,
      final IProcessingContext processingContext, final String input, final boolean allowParametersWithoutValue) {
   return AssignationUtils.parseAssignationSequence(configuration, processingContext, input,
         allowParametersWithoutValue);
}
 
开发者ID:dandelion,项目名称:dandelion-datatables,代码行数:19,代码来源:StandardExpressionParserWrapper.java



注:本文中的org.thymeleaf.Configuration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java VLCUtil类代码示例发布时间:2022-05-23
下一篇:
Java TCharShortMap类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap