本文整理了Java中freemarker.template.Configuration.setAPIBuiltinEnabled()
方法的一些代码示例,展示了Configuration.setAPIBuiltinEnabled()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.setAPIBuiltinEnabled()
方法的具体详情如下:
包路径:freemarker.template.Configuration
类名称:Configuration
方法名:setAPIBuiltinEnabled
暂无
代码示例来源:origin: sanluan/PublicCMS
/**
*
*/
public GetTemplateResultMethod() {
configuration = new Configuration(Configuration.getVersion());
configuration.setDefaultEncoding(CommonConstants.DEFAULT_CHARSET_NAME);
configuration.setTemplateUpdateDelayMilliseconds(0);
configuration.setAPIBuiltinEnabled(false);
configuration.setNewBuiltinClassResolver(TemplateClassResolver.ALLOWS_NOTHING_RESOLVER);
configuration.setLogTemplateExceptions(false);
}
代码示例来源:origin: sanluan/PublicCMS
/**
*
*/
public GetTemplateResultMethod() {
configuration = new Configuration(Configuration.getVersion());
configuration.setDefaultEncoding(CommonConstants.DEFAULT_CHARSET_NAME);
configuration.setTemplateUpdateDelayMilliseconds(0);
configuration.setAPIBuiltinEnabled(false);
configuration.setNewBuiltinClassResolver(TemplateClassResolver.ALLOWS_NOTHING_RESOLVER);
configuration.setLogTemplateExceptions(false);
}
代码示例来源:origin: com.github.mkolisnyk/cucumber-report-generator
private static void loadConfig(Map<String, String> resourceMap) throws Exception {
config = new Configuration(Configuration.VERSION_2_3_26);
TemplateLoader[] loaders = new TemplateLoader[] {};
for (Entry<String, String> resource : resourceMap.entrySet()) {
String templateString = "";
InputStream is = FreemarkerConfiguration.class.getResourceAsStream(resource.getValue());
if (is != null) {
templateString = IOUtils.toString(is);
} else {
templateString = FileUtils.readFileToString(new File(resource.getValue()), "UTF-8");
}
StringTemplateLoader stringLoader = new StringTemplateLoader();
stringLoader.putTemplate(resource.getKey(), templateString);
loaders = ArrayUtils.add(loaders, stringLoader);
}
MultiTemplateLoader multiLoader = new MultiTemplateLoader(loaders);
config.setTemplateLoader(multiLoader);
config.setDefaultEncoding("UTF-8");
config.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
config.setLogTemplateExceptions(false);
config.setAPIBuiltinEnabled(true);
config.setURLEscapingCharset("UTF-8");
config.setLocale(Locale.US);
BeansWrapperBuilder builder = new BeansWrapperBuilder(Configuration.VERSION_2_3_26);
TemplateHashModel staticModels = builder.build().getStaticModels();
config.setSharedVariable("statics", staticModels);
}
private static Map<String, String> loadTemplatesFromResource(String configFile) throws IOException {
代码示例来源:origin: windup/windup
/**
* Gets the default configuration for Freemarker within Windup.
*/
public static Configuration getDefaultFreemarkerConfiguration()
{
freemarker.template.Configuration configuration = new freemarker.template.Configuration(Configuration.VERSION_2_3_26);
DefaultObjectWrapperBuilder objectWrapperBuilder = new DefaultObjectWrapperBuilder(Configuration.VERSION_2_3_26);
objectWrapperBuilder.setUseAdaptersForContainers(true);
objectWrapperBuilder.setIterableSupport(true);
configuration.setObjectWrapper(objectWrapperBuilder.build());
configuration.setAPIBuiltinEnabled(true);
configuration.setTemplateLoader(new FurnaceFreeMarkerTemplateLoader());
configuration.setTemplateUpdateDelayMilliseconds(3600);
return configuration;
}
代码示例来源:origin: org.jboss.windup.reporting/windup-reporting-api
/**
* Gets the default configuration for Freemarker within Windup.
*/
public static Configuration getDefaultFreemarkerConfiguration()
{
freemarker.template.Configuration configuration = new freemarker.template.Configuration(Configuration.VERSION_2_3_26);
DefaultObjectWrapperBuilder objectWrapperBuilder = new DefaultObjectWrapperBuilder(Configuration.VERSION_2_3_26);
objectWrapperBuilder.setUseAdaptersForContainers(true);
objectWrapperBuilder.setIterableSupport(true);
configuration.setObjectWrapper(objectWrapperBuilder.build());
configuration.setAPIBuiltinEnabled(true);
configuration.setTemplateLoader(new FurnaceFreeMarkerTemplateLoader());
configuration.setTemplateUpdateDelayMilliseconds(3600);
return configuration;
}
代码示例来源:origin: revapi/revapi
/**
* Creates a new FreeMarker configuration.
* By default, it is configured as follows:
* <ul>
* <li>compatibility level is set to 2.3.23
* <li>the object wrapper is configured to expose fields
* <li>API builtins are enabled
* <li>there are 2 template loaders - 1 for loading templates from /META-INF using a classloader and a second
* one to load templates from files.
* </ul>
* @return
*/
protected Configuration createFreeMarkerConfiguration() {
DefaultObjectWrapperBuilder bld = new DefaultObjectWrapperBuilder(Configuration.VERSION_2_3_23);
bld.setExposeFields(true);
Configuration freeMarker = new Configuration(Configuration.VERSION_2_3_23);
freeMarker.setObjectWrapper(bld.build());
freeMarker.setAPIBuiltinEnabled(true);
freeMarker.setTemplateLoader(new MultiTemplateLoader(
new TemplateLoader[]{new ClassTemplateLoader(getClass(), "/META-INF"),
new NaiveFileTemplateLoader()}));
return freeMarker;
}
代码示例来源:origin: net.sourceforge.fmpp/fmpp
fmCfg.setNumberFormat("0.############");
fmCfg.setLocalizedLookup(false);
fmCfg.setAPIBuiltinEnabled(true); // Because there's pp.loadData('eval', ...) anyway.
内容来源于网络,如有侵权,请联系作者删除!