65 this.constructor = constructor;
67 setDirectoryForTemplateLoading(
new File(
templateRoot(constructor, mail)));
68 DefaultObjectWrapperBuilder dowb =
new DefaultObjectWrapperBuilder(VERSION_2_3_30);
69 dowb.setForceLegacyNonListCollections(
false);
70 setObjectWrapper(dowb.build());
71 setLocale(I_.api().used());
72 setDefaultEncoding(ElephantContext.getEncoding());
73 setOutputEncoding(ElephantContext.getEncoding());
74 setDateFormat(
"short");
75 setDateTimeFormat(
"short_short");
76 setEncoding(I_.api().used(), ElephantContext.getEncoding());
77 setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
78 setURLEscapingCharset(
"UTF-8");
79 setAPIBuiltinEnabled(
true);
80 root.put(
"constructor", constructor);
81 root.put(
"history", History.getInstance(constructor));
82 root.put(
"repository", IConstructor.currentRepository(constructor));
83 root.put(
"grepository", IConstructor.globalRepository());
84 root.put(
"serverURL", ElephantContext.getServerUrl(
"http"));
85 root.put(
"rootWebPath", ElephantContext.getRootWebPath());
86 root.put(
"siteName", ElephantContext.getSiteName());
87 root.put(
"labels", I_.compatibilityMap());
88 root.put(
"i_", I_.api());
89 root.put(
"i", I_.map());
90 root.put(
"k", I_.byKeyMap());
91 root.put(
"infoLink", EntityInfoContent.createURL(EntityInfoType.FULL, LinkType.WEB));
92 root.put(
"logoutURL", DirectContents.createRelativeURL(
"authentication") +
"/logout");
93 root.put(
"helper",
new MarkerHelper(constructor));
94 ContactIdentity identity =
new ContactIdentity();
95 root.put(
"identity", identity);
96 root.put(
"rolemap", identity.getPermissionMap());
98 if(getLocale() !=
null) {
99 root.put(
"lang", getLocale().getLanguage());
101 ElephantHelpers.addToMap(root);
102 }
catch (IOException ex) {
103 Logger.getLogger(
ElephantMarker.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
static String templateRoot(IConstructor constructor, boolean mail)
HttpServletResponse getResponse()
HttpServletRequest getRequest()