/** * Resets the setting to its default, as if it was never set. This means that when you change the * {@code incompatibe_improvements} setting later, the default will also change as appropriate. Also * {@link #isTemplateExceptionHandlerExplicitlySet()} will return {@code false}. * * @since 2.3.22 */ public void unsetLogTemplateExceptions() { if (logTemplateExceptionsExplicitlySet) { setLogTemplateExceptions(getDefaultLogTemplateExceptions()); logTemplateExceptionsExplicitlySet = false; } }
@Inject public ConfigurationService(MongoConnection mongoConnection, MongoJackObjectMapperProvider mapper, ConfigurationVariableService configurationVariableService) { super(mongoConnection, mapper, Configuration.class, COLLECTION_NAME); MongoDbTemplateLoader mongoDbTemplateLoader = new MongoDbTemplateLoader(db); MultiTemplateLoader multiTemplateLoader = new MultiTemplateLoader(new TemplateLoader[] { mongoDbTemplateLoader, stringTemplateLoader }); templateConfiguration.setTemplateLoader(multiTemplateLoader); templateConfiguration.setSharedVariable("indent", new IndentTemplateDirective()); templateConfiguration.setDefaultEncoding(UTF_8); templateConfiguration.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); templateConfiguration.setLogTemplateExceptions(false); this.configurationVariableService = configurationVariableService; }
config.setLogTemplateExceptions(false);
/** * */ 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); }
/** * */ 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); }
static Configuration getFreemarkerConfiguration() { final Configuration cfg = new Configuration(Configuration.VERSION_2_3_27); cfg.setClassForTemplateLoading(TemplateProcessor.class, ""); cfg.setLogTemplateExceptions(false); return cfg; }
static Configuration getFreemarkerConfiguration() { final Configuration cfg = new Configuration(Configuration.VERSION_2_3_27); cfg.setClassForTemplateLoading(TemplateProcessor.class, ""); cfg.setLogTemplateExceptions(false); return cfg; }
public Template() { fmCfg = new Configuration(Configuration.VERSION_2_3_28); fmCfg.setDefaultEncoding("UTF-8"); fmCfg.setLogTemplateExceptions(false); fmCfg.setWrapUncheckedExceptions(true); }
static Configuration getFreemarkerConfiguration() { final Configuration cfg = new Configuration(Configuration.VERSION_2_3_27); cfg.setClassForTemplateLoading(TemplateProcessor.class, ""); cfg.setLogTemplateExceptions(false); return cfg; }
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"))); } }
private static Configuration createFmConfig() { Configuration fmConfig = new Configuration(Configuration.VERSION_2_3_26); fmConfig.setClassLoaderForTemplateLoading( PortalWeblet.class.getClassLoader(), "org/jgrapes/portal"); fmConfig.setDefaultEncoding(UTF_8); fmConfig.setTemplateExceptionHandler( TemplateExceptionHandler.RETHROW_HANDLER); fmConfig.setLogTemplateExceptions(false); return fmConfig; }
private static void init() { if ( cfg == null ) { cfg = new Configuration(Configuration.VERSION_2_3_28); cfg.setDefaultEncoding("UTF-8"); cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); cfg.setLogTemplateExceptions(false); cfg.setWrapUncheckedExceptions(true); } }
void init(final String basePath) { cfg = new Configuration(Configuration.VERSION_2_3_28); cfg.setClassForTemplateLoading(this.getClass(), basePath); cfg.setDefaultEncoding("UTF-8"); cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); cfg.setLogTemplateExceptions(false); }
private static void init() { if ( cfg == null ) { cfg = new Configuration(Configuration.VERSION_2_3_28); cfg.setDefaultEncoding("UTF-8"); cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); cfg.setLogTemplateExceptions(false); cfg.setWrapUncheckedExceptions(true); } }
private void initTemplateFormatter() { LOGGER.debug("{} Initializing HTML template formatter", LOGGER_PREFIX_TAG); this.templateConfig = new Configuration(Configuration.VERSION_2_3_26); this.templateConfig.setDefaultEncoding("UTF-8"); this.templateConfig.setLocale(Locale.US); this.templateConfig.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); this.templateConfig.setLogTemplateExceptions(false); this.templateConfig.setClassForTemplateLoading(getClass(), TEMPLATES_REPORTS_HTML_LOCATION); LOGGER.debug("{} Finished initialization of HTML template formatter", LOGGER_PREFIX_TAG); }
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); }
private static Configuration createConfiguration() { final Configuration cfg = new Configuration(Configuration.getVersion()); cfg.setClassForTemplateLoading(TemplateConfiguration.class, "/megamek/common/templates"); cfg.setDefaultEncoding("UTF-8"); cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); cfg.setLogTemplateExceptions(false); cfg.setWrapUncheckedExceptions(true); return cfg; } }
public StructTemplate() { this.configuration = new Configuration(Configuration.getVersion()); this.loader = new StringTemplateLoader(); this.configuration.setTemplateLoader(this.loader); this.configuration.setDefaultEncoding("UTF-8"); this.configuration.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); this.configuration.setLogTemplateExceptions(false); this.configuration.setObjectWrapper(new ConnectObjectWrapper()); }
public StructTemplate() { this.configuration = new Configuration(Configuration.getVersion()); this.loader = new StringTemplateLoader(); this.configuration.setTemplateLoader(this.loader); this.configuration.setDefaultEncoding("UTF-8"); this.configuration.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); this.configuration.setLogTemplateExceptions(false); this.configuration.setObjectWrapper(new ConnectObjectWrapper()); }
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); } }