From: David ‘Bombe’ Roden Date: Thu, 19 Apr 2012 06:06:44 +0000 (+0200) Subject: Add basic filters and accessors. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=6a099c6363138c60b902566a068d59bbcb513a33;p=demoscenemusic.git Add basic filters and accessors. --- 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());