本文整理匯總了Java中freemarker.template.Configuration.setLogTemplateExceptions方法的典型用法代碼示例。如果您正苦於以下問題:Java Configuration.setLogTemplateExceptions方法的具體用法?Java Configuration.setLogTemplateExceptions怎麽用?Java Configuration.setLogTemplateExceptions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類freemarker.template.Configuration
的用法示例。
在下文中一共展示了Configuration.setLogTemplateExceptions方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: templateConfiguration
import freemarker.template.Configuration; //導入方法依賴的package包/類
private static Configuration templateConfiguration() {
Configuration configuration = new Configuration(Configuration.VERSION_2_3_26);
configuration.setDefaultEncoding("UTF-8");
configuration.setLogTemplateExceptions(false);
try {
configuration.setSetting("object_wrapper",
"DefaultObjectWrapper(2.3.26, forceLegacyNonListCollections=false, "
+ "iterableSupport=true, exposeFields=true)");
} catch (TemplateException e) {
e.printStackTrace();
}
configuration.setAPIBuiltinEnabled(true);
configuration.setClassLoaderForTemplateLoading(ClassLoader.getSystemClassLoader(),
"templates/ccda");
return configuration;
}
示例2: prepareConfiguration
import freemarker.template.Configuration; //導入方法依賴的package包/類
private static Configuration prepareConfiguration() {
Configuration result = new Configuration(Configuration.VERSION_2_3_26);
result.setNumberFormat("computer");
result.setDefaultEncoding(StandardCharsets.UTF_8.name());
result.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
result.setLogTemplateExceptions(false);
return result;
}
示例3: init
import freemarker.template.Configuration; //導入方法依賴的package包/類
public void init() throws IOException {
ClassTemplateLoader ctl = new ClassTemplateLoader(Application.class, "/freemarker");
MultiTemplateLoader mtl = new MultiTemplateLoader(new TemplateLoader[] {ctl});
Configuration cfg = new Configuration(Configuration.VERSION_2_3_25);
cfg.setTemplateLoader(mtl);
cfg.setDefaultEncoding("UTF-8");
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
cfg.setLogTemplateExceptions(false);
Pair<String, Template> clusterResourceQuota = new ImmutablePair<String, Template>("ClusterResourceQuota-ForUser", cfg.getTemplate("ClusterResourceQuota-ForUser.ftlh"));
Pair<String, Template> bestEffortResourceLimits = new ImmutablePair<String, Template>("LimitRange-BestEffortResourceLimits", cfg.getTemplate("LimitRange-BestEffortResourceLimits.ftlh"));
Pair<String, Template> burstableResourceLimits = new ImmutablePair<String, Template>("LimitRange-BurstableResourceLimits", cfg.getTemplate("LimitRange-BurstableResourceLimits.ftlh"));
Pair<String, Template> maxImageCounts = new ImmutablePair<String, Template>("LimitRange-MaxImageCounts", cfg.getTemplate("LimitRange-MaxImageCounts.ftlh"));
Pair<String, Template> bestEffort = new ImmutablePair<String, Template>("ResourceQuota-BestEffort", cfg.getTemplate("ResourceQuota-BestEffort.ftlh"));
Pair<String, Template> notTerminatingAndNotBestEffort = new ImmutablePair<String, Template>("ResourceQuota-NotTerminating-And-NotBestEffort",
cfg.getTemplate("ResourceQuota-NotTerminating-And-NotBestEffort.ftlh"));
Pair<String, Template> terminating = new ImmutablePair<String, Template>("ResourceQuota-Terminating", cfg.getTemplate("ResourceQuota-Terminating.ftlh"));
templates = Arrays.asList(clusterResourceQuota, bestEffortResourceLimits, burstableResourceLimits, maxImageCounts, bestEffort, notTerminatingAndNotBestEffort, terminating);
}
示例4: JoomlaHugoConverter
import freemarker.template.Configuration; //導入方法依賴的package包/類
public JoomlaHugoConverter(NastyContentChecker nastyContentChecker,
JdbcTemplate template, String pathToOutput, String dbExtension,
boolean buildTags) throws IOException {
this.dbExtension = dbExtension;
this.nastyContentChecker = nastyContentChecker;
this.template = template;
this.pathToOutput = pathToOutput;
this.buildTags = buildTags;
Configuration cfg = new Configuration(Configuration.getVersion());
cfg.setClassLoaderForTemplateLoading(ClassLoader.getSystemClassLoader(), "/");
cfg.setDefaultEncoding("UTF-8");
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
cfg.setLogTemplateExceptions(false);
categoryTemplate = cfg.getTemplate("categoryPage.toml.ftl");
contentTemplate = cfg.getTemplate("defaultPage.toml.ftl");
buildTags();
}
示例5: configuration
import freemarker.template.Configuration; //導入方法依賴的package包/類
@Singleton
@Provides
public static Configuration configuration(LinkHelper linkHelper, MultiTemplateLoader templateLoader) {
try {
freemarker.log.Logger.selectLoggerLibrary(Logger.LIBRARY_SLF4J);
Configuration cfg = new freemarker.template.Configuration(Configuration.VERSION_2_3_25);
cfg.setTagSyntax(freemarker.template.Configuration.SQUARE_BRACKET_TAG_SYNTAX);
cfg.setLazyAutoImports(true);
cfg.setLocale(Locale.GERMANY); // todo make configurable
cfg.addAutoImport("saito", "saito.ftl");
cfg.setSharedVariable("saitoLinkHelper", linkHelper);
cfg.setDefaultEncoding("UTF-8");
cfg.setLogTemplateExceptions(false);
cfg.setTemplateLoader(templateLoader);
return cfg;
} catch (TemplateModelException | ClassNotFoundException e) {
log.error("Error creating config", e);
throw new IllegalStateException(e);
}
}
示例6: TemplateService
import freemarker.template.Configuration; //導入方法依賴的package包/類
public TemplateService() {
String templatePath = new File("").getAbsolutePath();
System.out.println("Using template path '" + templatePath + "'.");
try {
config = new Configuration(Configuration.VERSION_2_3_25);
config.setDirectoryForTemplateLoading(new File(templatePath));
config.setDefaultEncoding("UTF-8");
config.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
config.setLogTemplateExceptions(false);
} catch (IOException e) {
throw new FileLibraryException(e);
}
}
示例7: PluginStatusReportViewBuilder
import freemarker.template.Configuration; //導入方法依賴的package包/類
private PluginStatusReportViewBuilder() throws IOException {
configuration = new Configuration(Configuration.VERSION_2_3_23);
configuration.setTemplateLoader(new ClassTemplateLoader(getClass(), "/"));
configuration.setDefaultEncoding("UTF-8");
configuration.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
configuration.setLogTemplateExceptions(false);
configuration.setDateTimeFormat("iso");
}
示例8: initializeTemplateConfiguration
import freemarker.template.Configuration; //導入方法依賴的package包/類
private static Configuration initializeTemplateConfiguration() throws IOException {
Configuration cfg = new Configuration(Configuration.getVersion());
cfg.setDefaultEncoding("UTF-8");
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
cfg.setLogTemplateExceptions(false);
return cfg;
}
示例9: FreeMarkerService
import freemarker.template.Configuration; //導入方法依賴的package包/類
private FreeMarkerService(Builder bulder) {
maxOutputLength = bulder.getMaxOutputLength();
maxThreads = bulder.getMaxThreads();
maxQueueLength = bulder.getMaxQueueLength();
maxTemplateExecutionTime = bulder.getMaxTemplateExecutionTime();
int actualMaxQueueLength = maxQueueLength != null
? maxQueueLength
: Math.max(
MIN_DEFAULT_MAX_QUEUE_LENGTH,
(int) (MAX_DEFAULT_MAX_QUEUE_LENGTH_MILLISECONDS / maxTemplateExecutionTime));
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(
maxThreads, maxThreads,
THREAD_KEEP_ALIVE_TIME, TimeUnit.MILLISECONDS,
new BlockingArrayQueue<Runnable>(actualMaxQueueLength));
threadPoolExecutor.allowCoreThreadTimeOut(true);
templateExecutor = threadPoolExecutor;
freeMarkerConfig = new Configuration(Configuration.getVersion());
freeMarkerConfig.setNewBuiltinClassResolver(TemplateClassResolver.ALLOWS_NOTHING_RESOLVER);
freeMarkerConfig.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
freeMarkerConfig.setLogTemplateExceptions(false);
freeMarkerConfig.setAttemptExceptionReporter(new AttemptExceptionReporter() {
@Override
public void report(TemplateException te, Environment env) {
// Suppress it
}
});
freeMarkerConfig.setLocale(AllowedSettingValuesMaps.DEFAULT_LOCALE);
freeMarkerConfig.setTimeZone(AllowedSettingValuesMaps.DEFAULT_TIME_ZONE);
freeMarkerConfig.setOutputFormat(AllowedSettingValuesMaps.DEFAULT_OUTPUT_FORMAT);
freeMarkerConfig.setOutputEncoding("UTF-8");
}
示例10: processIndexPageTemplate
import freemarker.template.Configuration; //導入方法依賴的package包/類
private void processIndexPageTemplate(ProjectDescriptor projectDescriptor, CustomData customData) throws IOException, URISyntaxException, TemplateException {
Configuration cfg = new Configuration(Configuration.VERSION_2_3_25);
cfg.setClassLoaderForTemplateLoading(getClass().getClassLoader(), "template");
cfg.setDefaultEncoding("UTF-8");
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
cfg.setLogTemplateExceptions(false);
Map<String, Object> root = new HashMap<String, Object>();
root.put("project", projectDescriptor);
root.put("customData", customData);
Template template = cfg.getTemplate("index.ftl");
template.process(root, new FileWriter(new File(outputDir, "index.html")));
}
示例11: init
import freemarker.template.Configuration; //導入方法依賴的package包/類
void init(final Class rootClass, final String basePath) {
cfg = new Configuration(Configuration.VERSION_2_3_26);
cfg.setClassForTemplateLoading(rootClass, basePath);
cfg.setDefaultEncoding("UTF-8");
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
cfg.setLogTemplateExceptions(false);
}
示例12: createConfiguration
import freemarker.template.Configuration; //導入方法依賴的package包/類
private void createConfiguration(String basePackagePath) {
cfg = new Configuration(Configuration.VERSION_2_3_26);
cfg.setClassLoaderForTemplateLoading(getClass().getClassLoader(), basePackagePath);
cfg.setLogTemplateExceptions(false);
setDefaultEncoding("UTF-8");
setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
}
示例13: createFreemarkerConfig
import freemarker.template.Configuration; //導入方法依賴的package包/類
public Configuration createFreemarkerConfig() throws IOException {
final Configuration cfg = new Configuration(Configuration.VERSION_2_3_25);
final File templateDirectory = findTemplateDirectory();
cfg.setDirectoryForTemplateLoading(templateDirectory);
cfg.setDefaultEncoding("UTF-8");
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.HTML_DEBUG_HANDLER);
cfg.setLogTemplateExceptions(false);
return cfg;
}
示例14: createConfiguration
import freemarker.template.Configuration; //導入方法依賴的package包/類
private static Configuration createConfiguration() {
Configuration configuration = new Configuration(Configuration.VERSION_2_3_25);
configuration.setClassForTemplateLoading(Templates.class, "/templates/appengine");
configuration.setDefaultEncoding(StandardCharsets.UTF_8.name());
configuration.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
configuration.setLogTemplateExceptions(false);
return configuration;
}
示例15: buildFreemarkerComment
import freemarker.template.Configuration; //導入方法依賴的package包/類
private String buildFreemarkerComment() {
Configuration cfg = new Configuration(Configuration.getVersion());
cfg.setDefaultEncoding("UTF-8");
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
cfg.setLogTemplateExceptions(false);
try (StringWriter sw = new StringWriter()) {
new Template(templateName, template, cfg).process(createContext(), sw);
return StringEscapeUtils.unescapeHtml4(sw.toString());
} catch (IOException | TemplateException e) {
LOG.error("Failed to create template {}", templateName, e);
throw MessageException.of("Failed to create template " + templateName);
}
}