use of freemarker.cache.WebappTemplateLoader in project wombat by PLOS.
the class SiteTemplateLoader method buildLoaders.
private static ImmutableMap<String, TemplateLoader> buildLoaders(ServletContext servletContext, SiteSet siteSet) throws IOException {
ImmutableMap.Builder<String, TemplateLoader> builder = ImmutableMap.builder();
// Add the loader for the application root page
builder.put("NULLSITE", new WebappTemplateLoader(servletContext, "/WEB-INF/themes/root/app/"));
// Add loader for each site
for (Site site : siteSet.getSites()) {
Theme leaf = site.getTheme();
List<TemplateLoader> loaders = Lists.newArrayList();
for (Theme theme : leaf.getInheritanceChain()) {
loaders.add(theme.getTemplateLoader());
}
MultiTemplateLoader multiLoader = new MultiTemplateLoader(loaders.toArray(new TemplateLoader[loaders.size()]));
builder.put(site.getKey(), multiLoader);
}
return builder.build();
}
Aggregations