/** * Intended for development only, checks if the template name matches the case (upper VS lower case letters) of the * actual file name, and if it doesn't, it emulates a file-not-found even if the file system is case insensitive. * This is useful when developing application on Windows, which will be later installed on Linux, OS X, etc. This * check can be resource intensive, as to check the file name the directories involved, up to the * {@link #getBaseDirectory()} directory, must be listed. Positive results (matching case) will be cached without * expiration time. * * <p>The default in {@link FileTemplateLoader} is {@code false}, but subclasses may change they by overriding * {@link #getEmulateCaseSensitiveFileSystemDefault()}. * * @since 2.3.23 */ public void setEmulateCaseSensitiveFileSystem(boolean nameCaseChecked) { // Ensure that the cache exists exactly when needed: if (nameCaseChecked) { if (correctCasePaths == null) { correctCasePaths = new MruCacheStorage(CASE_CHECH_CACHE_HARD_SIZE, CASE_CHECK_CACHE__SOFT_SIZE); } } else { correctCasePaths = null; } this.emulateCaseSensitiveFileSystem = nameCaseChecked; }
cfg.setCacheStorage(new freemarker.cache.MruCacheStorage(20, Integer.MAX_VALUE));
throw invalidSettingValueException(name, value); setCacheStorage(new MruCacheStorage(strongSize, softSize)); } else { setCacheStorage((CacheStorage) _ObjectBuilderSettingEvaluator.eval(
/** * Intended for development only, checks if the template name matches the case (upper VS lower case letters) of the * actual file name, and if it doesn't, it emulates a file-not-found even if the file system is case insensitive. * This is useful when developing application on Windows, which will be later installed on Linux, OS X, etc. This * check can be resource intensive, as to check the file name the directories involved, up to the * {@link #getBaseDirectory()} directory, must be listed. Positive results (matching case) will be cached without * expiration time. * * <p>The default in {@link FileTemplateLoader} is {@code false}, but subclasses may change they by overriding * {@link #getEmulateCaseSensitiveFileSystemDefault()}. * * @since 2.3.23 */ public void setEmulateCaseSensitiveFileSystem(boolean nameCaseChecked) { // Ensure that the cache exists exactly when needed: if (nameCaseChecked) { if (correctCasePaths == null) { correctCasePaths = new MruCacheStorage(CASE_CHECH_CACHE_HARD_SIZE, CASE_CHECK_CACHE__SOFT_SIZE); } } else { correctCasePaths = null; } this.emulateCaseSensitiveFileSystem = nameCaseChecked; }
/** * Intended for development only, checks if the template name matches the case (upper VS lower case letters) of the * actual file name, and if it doesn't, it emulates a file-not-found even if the file system is case insensitive. * This is useful when developing application on Windows, which will be later installed on Linux, OS X, etc. This * check can be resource intensive, as to check the file name the directories involved, up to the * {@link #getBaseDirectory()} directory, must be listed. Positive results (matching case) will be cached without * expiration time. * * <p>The default in {@link FileTemplateLoader} is {@code false}, but subclasses may change they by overriding * {@link #getEmulateCaseSensitiveFileSystemDefault()}. * * @since 2.3.23 */ public void setEmulateCaseSensitiveFileSystem(boolean nameCaseChecked) { // Ensure that the cache exists exactly when needed: if (nameCaseChecked) { if (correctCasePaths == null) { correctCasePaths = new MruCacheStorage(CASE_CHECH_CACHE_HARD_SIZE, CASE_CHECK_CACHE__SOFT_SIZE); } } else { correctCasePaths = null; } this.emulateCaseSensitiveFileSystem = nameCaseChecked; }
configuration.setCacheStorage(new freemarker.cache.MruCacheStorage(20, Integer.MAX_VALUE));
private Configuration createFreemarkerConfiguration(StringTemplateLoader stringTemplateLoader) { Configuration newConfiguration = new Configuration(DEFAULT_INCOMPATIBLE_IMPROVEMENTS); newConfiguration.setTagSyntax(Configuration.ANGLE_BRACKET_TAG_SYNTAX); newConfiguration.setDefaultEncoding("utf-8"); newConfiguration.setLocalizedLookup(true); newConfiguration.setCacheStorage(new MruCacheStorage(10, 100)); newConfiguration.setTemplateLoader(stringTemplateLoader); return newConfiguration; }
public TemplateEngine() { this.configuration.setClassForTemplateLoading(this.getClass(), Default.TEMPLATES_FOLDER.toString()); this.configuration.setDefaultEncoding(Charsets.UTF_8.name()); this.configuration.setOutputEncoding(Charsets.UTF_8.name()); this.configuration.setLocalizedLookup(false); this.configuration.setNumberFormat("0.######"); this.configuration.setTemplateLoader(new TemplateEngineLoader(configuration.getTemplateLoader())); if (Application.inDevMode()) { this.configuration.setTemplateUpdateDelayMilliseconds(ONE_SECOND_MS); } else { this.configuration.setTemplateUpdateDelayMilliseconds(Integer.MAX_VALUE); this.configuration.setCacheStorage(new MruCacheStorage(STRONG_SIZE_LIMIT, Integer.MAX_VALUE)); } StringBuilder buffer = new StringBuilder(); buffer.append(System.getProperty("user.dir")).append(File.separator) .append("src").append(File.separator).append("main") .append(File.separator).append("java"); this.baseDirectory = buffer.toString(); }
config.setCacheStorage(new MruCacheStorage(2, 0));
config.setCacheStorage(new MruCacheStorage(2, 0));
throw invalidSettingValueException(name, value); setCacheStorage(new MruCacheStorage(strongSize, softSize)); } else { setCacheStorage((CacheStorage) _ObjectBuilderSettingEvaluator.eval(
throw invalidSettingValueException(name, value); setCacheStorage(new MruCacheStorage(strongSize, softSize)); } else { setCacheStorage((CacheStorage) _ObjectBuilderSettingEvaluator.eval(
throw invalidSettingValueException(key, value); setCacheStorage(new MruCacheStorage(strongSize, softSize)); } else { setCacheStorage((CacheStorage) ClassUtil.forName(value)
config.setCacheStorage(new MruCacheStorage(512, 1024));
config.setCacheStorage(new MruCacheStorage(512, 1024));
stringConfig.setCacheStorage(new MruCacheStorage(2, 0)); stringConfig.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); stringConfig.setOutputEncoding("UTF-8");
stringConfig.setCacheStorage(new MruCacheStorage(2, 0)); stringConfig.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); stringConfig.setOutputEncoding("UTF-8");
stringConfig.setCacheStorage(new MruCacheStorage(2, 0)); stringConfig.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); stringConfig.setOutputEncoding("UTF-8");