All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zodiac.autoconfigure.template.velocity.view.VelocityTemplateViewProperties Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.autoconfigure.template.velocity.view;

import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.core.Ordered;
import org.zodiac.template.velocity.config.VelocityTemplateViewInfo;

@ConditionalOnWebApplication(type = Type.SERVLET)
@ConfigurationProperties(prefix = org.zodiac.template.velocity.constants.VelocityTemplateSystemPropertiesConstants.SPRING_TEMPLATE_VELOCITY_VIEW_PREFIX, ignoreInvalidFields = true)
public class VelocityTemplateViewProperties extends VelocityTemplateViewInfo {

    public VelocityTemplateViewProperties() {
    }

    public void applyToViewResolver(Object viewResolver) {
        org.zodiac.template.velocity.spring.view.VelocityViewResolver resolver = (org.zodiac.template.velocity.spring.view.VelocityViewResolver) 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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy