From: David ‘Bombe’ Roden Date: Thu, 19 Apr 2012 12:11:27 +0000 (+0200) Subject: Add classpath-based template provider to template context factory. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=54a8f96ccdfea1ab6deba3d565f182e184293f43;p=demoscenemusic.git Add classpath-based template provider to template context factory. --- diff --git a/src/main/java/net/pterodactylus/demoscenemusic/core/TemplateServlet.java b/src/main/java/net/pterodactylus/demoscenemusic/core/TemplateServlet.java index 9cfd7f5..1b1ce58 100644 --- a/src/main/java/net/pterodactylus/demoscenemusic/core/TemplateServlet.java +++ b/src/main/java/net/pterodactylus/demoscenemusic/core/TemplateServlet.java @@ -41,6 +41,7 @@ import net.pterodactylus.demoscenemusic.data.Artist; import net.pterodactylus.demoscenemusic.page.ServletRequest; import net.pterodactylus.util.io.Closer; import net.pterodactylus.util.io.StreamCopier; +import net.pterodactylus.util.template.ClassPathTemplateProvider; import net.pterodactylus.util.template.CollectionSortFilter; import net.pterodactylus.util.template.HtmlFilter; import net.pterodactylus.util.template.ReflectionAccessor; @@ -92,6 +93,8 @@ public class TemplateServlet extends HttpServlet { templateContextFactory.addTemplateObject("core", core); templateContextFactory.addTemplateObject("dataManager", core.getDataManager()); + templateContextFactory.addProvider(new ClassPathTemplateProvider(getClass(), "/templates/")); + for (@SuppressWarnings("rawtypes") Enumeration parameterNames = config.getInitParameterNames(); parameterNames.hasMoreElements();) { String pageName = (String) parameterNames.nextElement();