当前位置: 首页>>代码示例>>Java>>正文


Java SpringWebContext类代码示例

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


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

示例1: isVisible

import org.thymeleaf.spring4.context.SpringWebContext; //导入依赖的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

示例2: getModifiedAttributeValues

import org.thymeleaf.spring4.context.SpringWebContext; //导入依赖的package包/类
@Override
protected Map<String, String> getModifiedAttributeValues(Arguments arguments, Element element, String attributeName) {
    String href = "#";
    
    Expression expression = (Expression) StandardExpressions.getExpressionParser(arguments.getConfiguration())
            .parseExpression(arguments.getConfiguration(), arguments, element.getAttributeValue(attributeName));
    AdminSection section = (AdminSection) expression.execute(arguments.getConfiguration(), arguments);
    if (section != null) {
        HttpServletRequest request = ((SpringWebContext) arguments.getContext()).getHttpServletRequest();

        href = request.getContextPath() + section.getUrl();
    }
    
    Map<String, String> attrs = new HashMap<String, String>();
    attrs.put("href", href);
    return attrs;
}
 
开发者ID:takbani,项目名称:blcdemo,代码行数:18,代码来源:AdminSectionHrefProcessor.java

示例3: createHtmlContentFromTemplate

import org.thymeleaf.spring4.context.SpringWebContext; //导入依赖的package包/类
private String createHtmlContentFromTemplate(final User user, final Locale locale, final HttpServletRequest request,
                                             final HttpServletResponse response) {
    Map<String, Object> variables = new HashMap<>();
    variables.put("user", user);
    variables.put("baseUrl", request.getScheme() + "://" +   // "http" + "://
                             request.getServerName() +       // "myhost"
                             ":" + request.getServerPort());
    IWebContext context = new SpringWebContext(request, response, servletContext,
            locale, variables, applicationContext);
    return templateEngine.process("activationEmail", context);
}
 
开发者ID:sanketbajoria,项目名称:jittrackGTS,代码行数:12,代码来源:AccountResource.java

示例4: createHtmlContentFromTemplate

import org.thymeleaf.spring4.context.SpringWebContext; //导入依赖的package包/类
private String createHtmlContentFromTemplate(final User user, final Locale locale, final HttpServletRequest request,
                                             final HttpServletResponse response) {
    Map<String, Object> variables = new HashMap<String, Object>();
    variables.put("user", user);
    variables.put("baseUrl", request.getScheme() + "://" +   // "http" + "://
                             request.getServerName() +       // "myhost"
                             ":" + request.getServerPort());
    IWebContext context = new SpringWebContext(request, response, servletContext,
            locale, variables, applicationContext);
    return templateEngine.process(MailService.EMAIL_ACTIVATION_PREFIX + MailService.TEMPLATE_SUFFIX, context);
}
 
开发者ID:thpham,项目名称:ithings-demo,代码行数:12,代码来源:AccountResource.java

示例5: createHtmlContentFromTemplate

import org.thymeleaf.spring4.context.SpringWebContext; //导入依赖的package包/类
private String createHtmlContentFromTemplate(final User user, final Locale locale, final HttpServletRequest request,
                                             final HttpServletResponse response) {
    Map<String, Object> variables = new HashMap<String, Object>();
    variables.put("user", user);
    variables.put("baseUrl", request.getScheme() + "://" +   // "http" + "://
                             request.getServerName() +       // "myhost"
                             ":" + request.getServerPort());
    IWebContext context = new SpringWebContext(request, response, servletContext,
            locale, variables, applicationContext);
    return templateEngine.process("activationEmail", context);
}
 
开发者ID:la-team,项目名称:lightadmin-jhipster,代码行数:12,代码来源:AccountResource.java

示例6: evaluateTemplate

import org.thymeleaf.spring4.context.SpringWebContext; //导入依赖的package包/类
public String evaluateTemplate(String templateName, Locale locale, Map<String,?> variables) {
	IWebContext context = new SpringWebContext(request, null, servletContext, locale, variables, applicationContext);
	return templateEngine.process(templateName, context);

}
 
开发者ID:IHTSDO,项目名称:MLDS,代码行数:6,代码来源:TemplateEvaluator.java

示例7: getServletContext

import org.thymeleaf.spring4.context.SpringWebContext; //导入依赖的package包/类
private ServletContext getServletContext(Arguments arguments) {
       SpringWebContext ctx = (SpringWebContext)arguments.getContext();
       ServletContext application = ctx.getServletContext();
       return application;
}
 
开发者ID:connect-group,项目名称:thymesheet-sample,代码行数:6,代码来源:BaseAttributeProcessor.java


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