Java 类org.apache.velocity.runtime.resource.ResourceCacheImpl 实例源码

项目:sharding    文件:VelocityTemplateConfigurer.java   
@Override
protected void postProcessVelocityEngine(VelocityEngine velocityEngine) {
    super.postProcessVelocityEngine(velocityEngine);
    velocityEngine.setProperty(RuntimeConstants.RESOURCE_LOADER, "webapp,file,class,url,jar,spring,springMacro");
    velocityEngine.setProperty("webapp.resource.loader.class", WebappResourceLoader.class.getName());
    velocityEngine.setProperty("file.resource.loader.class", FileResourceLoader.class.getName());
    velocityEngine.setProperty("class.resource.loader.class", ClasspathResourceLoader.class.getName());
    velocityEngine.setProperty("url.resource.loader.class", URLResourceLoader.class.getName());
    velocityEngine.setProperty("jar.resource.loader.class", JarResourceLoader.class.getName());

    velocityEngine.setProperty("resource.manager.cache.class", ResourceCacheImpl.class.getName());
    velocityEngine.setProperty("resource.manager.cache.size", 2048);
    velocityEngine.setProperty("resource.manager.class", ResourceManagerImpl.class.getName());

    velocityEngine.setProperty(RuntimeConstants.COUNTER_INITIAL_VALUE, 1);
    velocityEngine.setProperty(RuntimeConstants.INPUT_ENCODING, inputEncoding);
    velocityEngine.setProperty(RuntimeConstants.OUTPUT_ENCODING, outputEncoding);
    velocityEngine.setProperty("contentType", contentType);
    // org.apache.velocity.runtime.log.AvalonLogChute
    // org.apache.velocity.runtime.log.Log4JLogChute
    // org.apache.velocity.runtime.log.CommonsLogLogChute
    // org.apache.velocity.runtime.log.ServletLogChute
    // org.apache.velocity.runtime.log.JdkLogChute
    velocityEngine.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, new Log4JLogChute());
    velocityEngine.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_CACHE, true);
}