本文整理匯總了Java中freemarker.template.Configuration.VERSION_2_3_0屬性的典型用法代碼示例。如果您正苦於以下問題:Java Configuration.VERSION_2_3_0屬性的具體用法?Java Configuration.VERSION_2_3_0怎麽用?Java Configuration.VERSION_2_3_0使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類freemarker.template.Configuration
的用法示例。
在下文中一共展示了Configuration.VERSION_2_3_0屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: message
private String message() throws IOException, TemplateException {
Configuration cfg = new Configuration(Configuration.VERSION_2_3_0);
cfg.setClassForTemplateLoading(EventEmail.class, "");
cfg.setLocale(Localization.getJavaLocale());
cfg.setOutputEncoding("utf-8");
Template template = cfg.getTemplate("confirmation.ftl");
Map<String, Object> input = new HashMap<String, Object>();
input.put("msg", MESSAGES);
input.put("const", CONSTANTS);
input.put("subject", subject());
input.put("event", event());
input.put("operation", request().getOperation() == null ? "NONE" : request().getOperation().name());
if (response().hasCreatedMeetings())
input.put("created", EventInterface.getMultiMeetings(response().getCreatedMeetings(), true, false));
if (response().hasDeletedMeetings())
input.put("deleted", EventInterface.getMultiMeetings(response().getDeletedMeetings(), true, false));
if (response().hasCancelledMeetings())
input.put("cancelled", EventInterface.getMultiMeetings(response().getCancelledMeetings(), true, false));
if (response().hasUpdatedMeetings())
input.put("updated", EventInterface.getMultiMeetings(response().getUpdatedMeetings(), true, false));
if (request().hasMessage())
input.put("message", request().getMessage());
if (request().getEvent().getId() != null) {
if (event().hasMeetings()) {
input.put("meetings", EventInterface.getMultiMeetings(event().getMeetings(), true, false));
} else
input.put("meetings", new TreeSet<MultiMeetingInterface>());
}
input.put("version", MESSAGES.pageVersion(Constants.getVersion(), Constants.getReleaseDate()));
input.put("ts", new Date());
input.put("link", ApplicationProperty.UniTimeUrl.value());
input.put("sessionId", iRequest.getSessionId());
StringWriter s = new StringWriter();
template.process(input, new PrintWriter(s));
s.flush(); s.close();
return s.toString();
}
示例2: init
@Override
public FreemarkerTemplateEngine init(ConfigBuilder configBuilder) {
super.init(configBuilder);
configuration = new Configuration(Configuration.VERSION_2_3_0);
configuration.setDefaultEncoding(ConstVal.UTF8);
configuration.setClassForTemplateLoading(FreemarkerTemplateEngine.class, "/");
return this;
}