Search in sources :

Example 1 with VelocityEngineFactoryBean

use of org.springframework.ui.velocity.VelocityEngineFactoryBean in project cas by apereo.

the class CoreSamlConfiguration method velocityEngineFactoryBean.

/**
     * Velocity engine velocity engine factory bean.
     *
     * @return the velocity engine factory bean
     */
@Lazy
@Bean(name = "shibboleth.VelocityEngine")
public VelocityEngineFactoryBean velocityEngineFactoryBean() {
    final VelocityEngineFactoryBean bean = new VelocityEngineFactoryBean();
    final Properties properties = new Properties();
    properties.put(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, SLF4JLogChute.class.getName());
    properties.put(RuntimeConstants.INPUT_ENCODING, StandardCharsets.UTF_8.name());
    properties.put(RuntimeConstants.OUTPUT_ENCODING, StandardCharsets.UTF_8.name());
    properties.put(RuntimeConstants.ENCODING_DEFAULT, StandardCharsets.UTF_8.name());
    properties.put(RuntimeConstants.RESOURCE_LOADER, "file, classpath, string");
    properties.put(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, FileUtils.getTempDirectory().getAbsolutePath());
    properties.put(RuntimeConstants.FILE_RESOURCE_LOADER_CACHE, Boolean.FALSE);
    properties.put("classpath.resource.loader.class", ClasspathResourceLoader.class.getName());
    properties.put("string.resource.loader.class", StringResourceLoader.class.getName());
    properties.put("file.resource.loader.class", FileResourceLoader.class.getName());
    bean.setOverrideLogging(false);
    bean.setVelocityProperties(properties);
    return bean;
}
Also used : VelocityEngineFactoryBean(org.springframework.ui.velocity.VelocityEngineFactoryBean) SLF4JLogChute(net.shibboleth.utilities.java.support.velocity.SLF4JLogChute) FileResourceLoader(org.apache.velocity.runtime.resource.loader.FileResourceLoader) StringResourceLoader(org.apache.velocity.runtime.resource.loader.StringResourceLoader) ClasspathResourceLoader(org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader) CasConfigurationProperties(org.apereo.cas.configuration.CasConfigurationProperties) EnableConfigurationProperties(org.springframework.boot.context.properties.EnableConfigurationProperties) Properties(java.util.Properties) Lazy(org.springframework.context.annotation.Lazy) VelocityEngineFactoryBean(org.springframework.ui.velocity.VelocityEngineFactoryBean) OpenSamlConfigBean(org.apereo.cas.support.saml.OpenSamlConfigBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

Properties (java.util.Properties)1 SLF4JLogChute (net.shibboleth.utilities.java.support.velocity.SLF4JLogChute)1 ClasspathResourceLoader (org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader)1 FileResourceLoader (org.apache.velocity.runtime.resource.loader.FileResourceLoader)1 StringResourceLoader (org.apache.velocity.runtime.resource.loader.StringResourceLoader)1 CasConfigurationProperties (org.apereo.cas.configuration.CasConfigurationProperties)1 OpenSamlConfigBean (org.apereo.cas.support.saml.OpenSamlConfigBean)1 EnableConfigurationProperties (org.springframework.boot.context.properties.EnableConfigurationProperties)1 Bean (org.springframework.context.annotation.Bean)1 Lazy (org.springframework.context.annotation.Lazy)1 VelocityEngineFactoryBean (org.springframework.ui.velocity.VelocityEngineFactoryBean)1