Java 类org.springframework.web.servlet.view.AbstractTemplateViewResolver 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:AbstractTemplateViewResolverProperties.java   
/**
 * 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);
}
项目:spring-boot-concourse    文件:AbstractTemplateViewResolverProperties.java   
/**
 * 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);
}
项目:contestparser    文件:AbstractTemplateViewResolverProperties.java   
/**
 * 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);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:FreeMarkerAutoConfigurationTests.java   
@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);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:VelocityAutoConfigurationTests.java   
@Test
public void allowSessionOverride() {
    registerAndRefreshContext("spring.velocity.allow-session-override:true");
    AbstractTemplateViewResolver viewResolver = this.context
            .getBean(VelocityViewResolver.class);
    assertThat(viewResolver).extracting("allowSessionOverride").containsExactly(true);
}
项目:spring-boot-concourse    文件:FreeMarkerAutoConfigurationTests.java   
@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);
}
项目:spring-boot-concourse    文件:VelocityAutoConfigurationTests.java   
@Test
public void allowSessionOverride() {
    registerAndRefreshContext("spring.velocity.allow-session-override:true");
    AbstractTemplateViewResolver viewResolver = this.context
            .getBean(VelocityViewResolver.class);
    assertThat(viewResolver).extracting("allowSessionOverride").containsExactly(true);
}
项目:contestparser    文件:FreeMarkerAutoConfigurationTests.java   
@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));
}
项目:contestparser    文件:VelocityAutoConfigurationTests.java   
@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));
}