From 54a8f96ccdfea1ab6deba3d565f182e184293f43 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 19 Apr 2012 14:11:27 +0200 Subject: [PATCH] Add classpath-based template provider to template context factory. --- .../java/net/pterodactylus/demoscenemusic/core/TemplateServlet.java | 3 +++ 1 file changed, 3 insertions(+) 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(); -- 2.7.4