Package net.csdn.bootstrap.loader.impl

Source Code of net.csdn.bootstrap.loader.impl.TemplateLoader

package net.csdn.bootstrap.loader.impl;

import net.csdn.bootstrap.loader.Loader;
import net.csdn.common.env.Environment;
import net.csdn.common.settings.Settings;
import org.apache.velocity.app.Velocity;

import java.util.Properties;

/**
* 6/29/13 WilliamZhu(allwefantasy@gmail.com)
*/
public class TemplateLoader implements Loader {
    @Override
    public void load(Settings settings) throws Exception {
        Environment environment = new Environment(settings);
        if (settings.getAsBoolean("application.template.engine.enable", false)) {
            Properties properties = new Properties();
            properties.setProperty("file.resource.loader.path", environment.templateDirFile().getPath());
            properties.setProperty("input.encoding", "utf-8");
            properties.setProperty("output.encoding", "utf-8");
            properties.setProperty("runtime.log", environment.logsFile().getPath() + "/template");
            Velocity.init(properties);
        }
    }
}
TOP

Related Classes of net.csdn.bootstrap.loader.impl.TemplateLoader

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.