本文整理汇总了Java中org.springframework.web.servlet.view.AbstractTemplateView类的典型用法代码示例。如果您正苦于以下问题:Java AbstractTemplateView类的具体用法?Java AbstractTemplateView怎么用?Java AbstractTemplateView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbstractTemplateView类属于org.springframework.web.servlet.view包,在下文中一共展示了AbstractTemplateView类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decorator
import org.springframework.web.servlet.view.AbstractTemplateView; //导入依赖的package包/类
@RequestMapping("/decorator")
public void decorator(HttpServletRequest request, HttpServletResponse response) throws Exception {
AbstractTemplateView view = (AbstractTemplateView)viewResolver.resolveViewName("decorator",
localeResolver.resolveLocale(request));
//因为此请求是Sitemesh forward进来的,如果不做下面两个Override配置的话会重复设置Model,而Spring MVC碰到重复参数名会抛异常
//详细逻辑请阅读 {@link AbstractTemplateView} 的 renderMergedOutputModel方法
//启用spring.freemarker.expose-request-attributes=true时则需要启用下面的代码
//view.setAllowRequestOverride(true);
//启用spring.freemarker.expose-session-attributes=true时则需要启用下面的代码
//view.setAllowSessionOverride(true);
view.setExposeSpringMacroHelpers(false);
view.render(null, request, response);
}
示例2: call
import org.springframework.web.servlet.view.AbstractTemplateView; //导入依赖的package包/类
@Override
public Object call(Object[] paras, Context ctx) {
RequestContext requestContext = (RequestContext) ctx
.getGlobal(AbstractTemplateView.SPRING_MACRO_REQUEST_CONTEXT_ATTRIBUTE);
Assert.notNull(requestContext);
Assert.notNull(paras);
Assert.isTrue(paras.length > 0);
String code = (String) paras[0];
Object[] args = paras.length > 1 ? Arrays.copyOfRange(paras, 1, paras.length) : null;
return requestContext.getMessage(code, args);
}
示例3: additionalVariableProcessing
import org.springframework.web.servlet.view.AbstractTemplateView; //导入依赖的package包/类
private void additionalVariableProcessing(ConversionService conversionService, Map<String, Object> variables) {
RequestContext requestContext = (RequestContext) variables.get(AbstractTemplateView.SPRING_MACRO_REQUEST_CONTEXT_ATTRIBUTE);
variables.put(SpringContextVariableNames.SPRING_REQUEST_CONTEXT, requestContext);
ThymeleafEvaluationContext evaluationContext = new ThymeleafEvaluationContext(applicationContext, conversionService);
variables.put(ThymeleafEvaluationContext.THYMELEAF_EVALUATION_CONTEXT_CONTEXT_VARIABLE_NAME, evaluationContext);
}
示例4: initialize
import org.springframework.web.servlet.view.AbstractTemplateView; //导入依赖的package包/类
protected <V extends AbstractTemplateView> V initialize (V view) {
super.initialize (view);
view.setAllowRequestOverride (allowRequestOverride);
view.setAllowSessionOverride (allowSessionOverride);
view.setExposeRequestAttributes (exposeRequestAttributes);
view.setExposeSessionAttributes (exposeSessionAttributes);
view.setExposeSpringMacroHelpers (exposeSpringMacroHelpers);
return view;
}
示例5: doAdditionalVariableProcessing
import org.springframework.web.servlet.view.AbstractTemplateView; //导入依赖的package包/类
private void doAdditionalVariableProcessing(ITest test, Locale locale, Map<String, Object> variables) {
servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, applicationContext);
request.setAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE, applicationContext);
RequestContextHolder.setRequestAttributes(webRequest);
ConversionService conversionService = getConversionService();
RequestContext requestContext = new RequestContext(request, response, servletContext, variables);
variables.put(AbstractTemplateView.SPRING_MACRO_REQUEST_CONTEXT_ATTRIBUTE, requestContext);
additionalVariableProcessing(conversionService, variables);
initializeBindingResults(test, conversionService, locale, variables);
injectJawrProperties(test);
}