org.springframework.web.servlet.view.AbstractTemplateViewResolver Java Examples

The following examples show how to use org.springframework.web.servlet.view.AbstractTemplateViewResolver. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VelocityProperties.java    From velocity-spring-boot-project with Apache License 2.0 6 votes vote down vote up
/**
 * 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.
 */
protected void doApplyToViewResolver(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);
}