Add basic filters and accessors.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 19 Apr 2012 06:06:44 +0000 (08:06 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 19 Apr 2012 06:06:44 +0000 (08:06 +0200)
src/main/java/net/pterodactylus/demoscenemusic/core/TemplateServlet.java

index a2ec825..b93fe01 100644 (file)
@@ -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());