From 6a099c6363138c60b902566a068d59bbcb513a33 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 19 Apr 2012 08:06:44 +0200 Subject: [PATCH] Add basic filters and accessors. --- .../java/net/pterodactylus/demoscenemusic/core/TemplateServlet.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/net/pterodactylus/demoscenemusic/core/TemplateServlet.java b/src/main/java/net/pterodactylus/demoscenemusic/core/TemplateServlet.java index a2ec825..b93fe01 100644 --- a/src/main/java/net/pterodactylus/demoscenemusic/core/TemplateServlet.java +++ b/src/main/java/net/pterodactylus/demoscenemusic/core/TemplateServlet.java @@ -36,6 +36,8 @@ import javax.servlet.http.HttpServletResponse; import net.pterodactylus.demoscenemusic.page.ServletRequest; import net.pterodactylus.util.io.Closer; +import net.pterodactylus.util.template.HtmlFilter; +import net.pterodactylus.util.template.ReflectionAccessor; import net.pterodactylus.util.template.Template; import net.pterodactylus.util.template.TemplateContextFactory; import net.pterodactylus.util.template.TemplateParser; @@ -67,6 +69,10 @@ public class TemplateServlet extends HttpServlet { super.init(config); core = (Core) config.getServletContext().getAttribute("core"); + templateContextFactory.addAccessor(Object.class, new ReflectionAccessor()); + + templateContextFactory.addFilter("html", new HtmlFilter()); + templateContextFactory.addTemplateObject("core", core); templateContextFactory.addTemplateObject("dataManager", core.getDataManager()); -- 2.7.4