當前位置: 首頁>>代碼示例>>Java>>正文


Java Configuration.getVersion方法代碼示例

本文整理匯總了Java中freemarker.template.Configuration.getVersion方法的典型用法代碼示例。如果您正苦於以下問題:Java Configuration.getVersion方法的具體用法?Java Configuration.getVersion怎麽用?Java Configuration.getVersion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在freemarker.template.Configuration的用法示例。


在下文中一共展示了Configuration.getVersion方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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();
}
 
開發者ID:davetcc,項目名稱:hugojoomla,代碼行數:23,代碼來源:JoomlaHugoConverter.java

示例2: init

import freemarker.template.Configuration; //導入方法依賴的package包/類
@PostConstruct
public void init() throws IOException {
  try {
    cfg = new Configuration(Configuration.getVersion());
    cfg.setDirectoryForTemplateLoading(new File(templateLocation));
    cfg.setDefaultEncoding(templateEncoding);
    cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
  } catch (IOException e) {
    logger.error("Problem getting rule template location." + e.getMessage());
    throw e;
  }
}
 
開發者ID:edgexfoundry,項目名稱:support-rulesengine,代碼行數:13,代碼來源:RuleCreator.java

示例3: 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;
}
 
開發者ID:tsiq,項目名稱:magic-beanstalk,代碼行數:8,代碼來源:FileGenerator.java

示例4: buildReport

import freemarker.template.Configuration; //導入方法依賴的package包/類
private String buildReport(ITestContext test) {
	try {
		InputStream is = HtmlReporter.class.getResourceAsStream(REPORT_TEMPLATE);
		Configuration cfg = new Configuration(Configuration.getVersion());
		Template template = new Template("Report", new InputStreamReader(is), cfg);
		Map<String, Object> parameters = new HashMap<String, Object>();
		parameters.put("context", test);
		StringWriter writer = new StringWriter();
		template.process(parameters, writer);
		return writer.toString();
	} catch (Exception e) {
		log.error("Build Report error", e);
		return "Exception: " + e.getMessage();
	}
}
 
開發者ID:21ca,項目名稱:selenium-testng-template,代碼行數:16,代碼來源:HtmlReporter.java

示例5: 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");
 }
 
開發者ID:apache,項目名稱:incubator-freemarker-online-tester,代碼行數:34,代碼來源:FreeMarkerService.java

示例6: loadTemplates

import freemarker.template.Configuration; //導入方法依賴的package包/類
@BeforeAll
public static void loadTemplates() {
  loader = new ClassTemplateLoader(
      BaseDocumentationTest.class,
      "templates"
  );

  configuration = new Configuration(Configuration.getVersion());
  configuration.setDefaultEncoding("UTF-8");
  configuration.setTemplateLoader(loader);
  configuration.setObjectWrapper(new BeansWrapper(Configuration.getVersion()));
}
 
開發者ID:jcustenborder,項目名稱:connect-utils,代碼行數:13,代碼來源:BaseDocumentationTest.java

示例7: StructTemplate

import freemarker.template.Configuration; //導入方法依賴的package包/類
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());
}
 
開發者ID:jcustenborder,項目名稱:connect-utils,代碼行數:10,代碼來源:StructTemplate.java

示例8: showRollupEmail

import freemarker.template.Configuration; //導入方法依賴的package包/類
@GET
@Timed
@Path("/rollup")
@Produces(MediaType.TEXT_HTML)
public Response showRollupEmail(@Auth Person user, @QueryParam("startDate") Long start, 
		@QueryParam("endDate") Long end, 
		@QueryParam("orgType") OrganizationType orgType, 
		@QueryParam("advisorOrganizationId") Integer advisorOrgId,
		@QueryParam("principalOrganizationId") Integer principalOrgId,
		@QueryParam("showText") @DefaultValue("false") Boolean showReportText) {
	DailyRollupEmail action = new DailyRollupEmail();
	action.setStartDate(new DateTime(start));
	action.setEndDate(new DateTime(end));
	action.setChartOrgType(orgType);
	action.setAdvisorOrganizationId(advisorOrgId);
	action.setPrincipalOrganizationId(principalOrgId);
	
	Map<String,Object> context = action.execute();
	context.put("serverUrl", config.getServerUrl());
	context.put(AdminSettingKeys.SECURITY_BANNER_TEXT.name(), engine.getAdminSetting(AdminSettingKeys.SECURITY_BANNER_TEXT));
	context.put(AdminSettingKeys.SECURITY_BANNER_COLOR.name(), engine.getAdminSetting(AdminSettingKeys.SECURITY_BANNER_COLOR));
	context.put(DailyRollupEmail.SHOW_REPORT_TEXT_FLAG, showReportText);
	
	try { 
		Configuration freemarkerConfig = new Configuration(Configuration.getVersion());
		freemarkerConfig.setObjectWrapper(new DefaultObjectWrapperBuilder(Configuration.getVersion()).build());
		freemarkerConfig.loadBuiltInEncodingMap();
		freemarkerConfig.setDefaultEncoding(StandardCharsets.UTF_8.name());
		freemarkerConfig.setClassForTemplateLoading(this.getClass(), "/");
		freemarkerConfig.setAPIBuiltinEnabled(true);
		
		Template temp = freemarkerConfig.getTemplate(action.getTemplateName());
		StringWriter writer = new StringWriter();
		temp.process(context, writer);
		
		return Response.ok(writer.toString(), MediaType.TEXT_HTML_TYPE).build();
	} catch (Exception e) { 
		throw new WebApplicationException(e);
	}
}
 
開發者ID:deptofdefense,項目名稱:anet,代碼行數:41,代碼來源:ReportResource.java

示例9: AnetEmailWorker

import freemarker.template.Configuration; //導入方法依賴的package包/類
public AnetEmailWorker(Handle dbHandle, AnetConfiguration config, ScheduledExecutorService scheduler) { 
	this.handle = dbHandle;
	this.scheduler = scheduler;
	this.mapper = new ObjectMapper();
	mapper.registerModule(new JodaModule());
	//mapper.enableDefaultTyping();
	this.emailMapper = new AnetEmailMapper();
	this.fromAddr = config.getEmailFromAddr();
	this.serverUrl = config.getServerUrl();
	instance = this;
	
	SmtpConfiguration smtpConfig = config.getSmtp();
	props = new Properties();
	props.put("mail.smtp.starttls.enable", smtpConfig.getStartTls().toString());
	props.put("mail.smtp.host", smtpConfig.getHostname());
	props.put("mail.smtp.port", smtpConfig.getPort().toString());
	auth = null;
	
	if (smtpConfig.getUsername() != null && smtpConfig.getUsername().trim().length() > 0) { 
		props.put("mail.smtp.auth", "true");
		auth = new javax.mail.Authenticator() {
			protected PasswordAuthentication getPasswordAuthentication() {
				return new PasswordAuthentication(smtpConfig.getUsername(), smtpConfig.getPassword());
			}
		};
	}
	
	freemarkerConfig = new Configuration(Configuration.getVersion());
	freemarkerConfig.setObjectWrapper(new DefaultObjectWrapperBuilder(Configuration.getVersion()).build());
	freemarkerConfig.loadBuiltInEncodingMap();
	freemarkerConfig.setDefaultEncoding(StandardCharsets.UTF_8.name());
	freemarkerConfig.setClassForTemplateLoading(this.getClass(), "/");
	freemarkerConfig.setAPIBuiltinEnabled(true);
}
 
開發者ID:deptofdefense,項目名稱:anet,代碼行數:35,代碼來源:AnetEmailWorker.java

示例10: 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);
    }
}
 
開發者ID:gabrie-allaigre,項目名稱:sonar-gitlab-plugin,代碼行數:15,代碼來源:AbstractCommentBuilder.java


注:本文中的freemarker.template.Configuration.getVersion方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。