本文整理汇总了Java中org.springframework.web.servlet.view.AbstractTemplateViewResolver类的典型用法代码示例。如果您正苦于以下问题:Java AbstractTemplateViewResolver类的具体用法?Java AbstractTemplateViewResolver怎么用?Java AbstractTemplateViewResolver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AbstractTemplateViewResolver类属于org.springframework.web.servlet.view包,在下文中一共展示了AbstractTemplateViewResolver类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyToViewResolver
import org.springframework.web.servlet.view.AbstractTemplateViewResolver; //导入依赖的package包/类
/**
* Apply the given properties to a {@link AbstractTemplateViewResolver}. Use Object in
* signature to avoid runtime dependency on MVC, which means that the template engine
* can be used in a non-web application.
* @param viewResolver the resolver to apply the properties to.
*/
public void applyToViewResolver(Object viewResolver) {
Assert.isInstanceOf(AbstractTemplateViewResolver.class, viewResolver,
"ViewResolver is not an instance of AbstractTemplateViewResolver :"
+ viewResolver);
AbstractTemplateViewResolver resolver = (AbstractTemplateViewResolver) viewResolver;
resolver.setPrefix(getPrefix());
resolver.setSuffix(getSuffix());
resolver.setCache(isCache());
if (getContentType() != null) {
resolver.setContentType(getContentType().toString());
}
resolver.setViewNames(getViewNames());
resolver.setExposeRequestAttributes(isExposeRequestAttributes());
resolver.setAllowRequestOverride(isAllowRequestOverride());
resolver.setAllowSessionOverride(isAllowSessionOverride());
resolver.setExposeSessionAttributes(isExposeSessionAttributes());
resolver.setExposeSpringMacroHelpers(isExposeSpringMacroHelpers());
resolver.setRequestContextAttribute(getRequestContextAttribute());
// The resolver usually acts as a fallback resolver (e.g. like a
// InternalResourceViewResolver) so it needs to have low precedence
resolver.setOrder(Ordered.LOWEST_PRECEDENCE - 5);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:29,代码来源:AbstractTemplateViewResolverProperties.java
示例2: allowSessionOverride
import org.springframework.web.servlet.view.AbstractTemplateViewResolver; //导入依赖的package包/类
@Test
public void allowSessionOverride() {
registerAndRefreshContext("spring.freemarker.allow-session-override:true");
AbstractTemplateViewResolver viewResolver = this.context
.getBean(FreeMarkerViewResolver.class);
assertThat(ReflectionTestUtils.getField(viewResolver, "allowSessionOverride"))
.isEqualTo(true);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:FreeMarkerAutoConfigurationTests.java
示例3: allowSessionOverride
import org.springframework.web.servlet.view.AbstractTemplateViewResolver; //导入依赖的package包/类
@Test
public void allowSessionOverride() {
registerAndRefreshContext("spring.velocity.allow-session-override:true");
AbstractTemplateViewResolver viewResolver = this.context
.getBean(VelocityViewResolver.class);
assertThat(viewResolver).extracting("allowSessionOverride").containsExactly(true);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:VelocityAutoConfigurationTests.java
示例4: allowSessionOverride
import org.springframework.web.servlet.view.AbstractTemplateViewResolver; //导入依赖的package包/类
@Test
public void allowSessionOverride() {
registerAndRefreshContext("spring.freemarker.allow-session-override:true");
AbstractTemplateViewResolver viewResolver = this.context
.getBean(FreeMarkerViewResolver.class);
assertThat((Boolean) ReflectionTestUtils.getField(viewResolver,
"allowSessionOverride"), is(true));
}
示例5: allowSessionOverride
import org.springframework.web.servlet.view.AbstractTemplateViewResolver; //导入依赖的package包/类
@Test
public void allowSessionOverride() {
registerAndRefreshContext("spring.velocity.allow-session-override:true");
AbstractTemplateViewResolver viewResolver = this.context
.getBean(VelocityViewResolver.class);
assertThat((Boolean) ReflectionTestUtils.getField(viewResolver,
"allowSessionOverride"), is(true));
}