Perform certain processing in all pages.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 26 Apr 2012 13:41:04 +0000 (15:41 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 26 Apr 2012 13:41:04 +0000 (15:41 +0200)
src/main/java/net/pterodactylus/demoscenemusic/page/BasePage.java

index 5990c4f..88f5fc7 100644 (file)
@@ -19,7 +19,9 @@ package net.pterodactylus.demoscenemusic.page;
 
 import net.pterodactylus.demoscenemusic.core.Core;
 import net.pterodactylus.util.template.Template;
+import net.pterodactylus.util.template.TemplateContext;
 import net.pterodactylus.util.template.TemplateContextFactory;
+import net.pterodactylus.util.web.RedirectException;
 import net.pterodactylus.util.web.TemplatePage;
 
 /**
@@ -49,4 +51,13 @@ public class BasePage extends TemplatePage<ServletRequest> {
                return core;
        }
 
+       /**
+        * {@inheritDoc}
+        */
+       @Override
+       protected void processTemplate(TemplateContext templateContext, ServletRequest request) throws RedirectException {
+               super.processTemplate(templateContext, request);
+               templateContext.set("currentUser", request.getServletRequest().getAttribute("currentUser"));
+       }
+
 }