当前位置: 首页>>代码示例>>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;未经允许,请勿转载。