Fix more project names in headers.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / page / FreenetTemplatePage.java
index 97c8bf3..6e7812f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * shortener - TemplatePage.java - Copyright © 2010 David Roden
+ * Sone - FreenetTemplatePage.java - Copyright © 2010 David Roden
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -20,6 +20,9 @@ package net.pterodactylus.sone.web.page;
 import java.io.StringWriter;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -32,6 +35,7 @@ import freenet.clients.http.LinkEnabledCallback;
 import freenet.clients.http.PageMaker;
 import freenet.clients.http.PageNode;
 import freenet.clients.http.ToadletContext;
+import freenet.support.HTMLNode;
 
 /**
  * Base class for all {@link Page}s that are rendered with {@link Template}s and
@@ -118,6 +122,12 @@ public class FreenetTemplatePage implements Page, LinkEnabledCallback {
                for (String styleSheet : getStyleSheets()) {
                        pageNode.addCustomStyleSheet(styleSheet);
                }
+               for (Map<String, String> linkNodeParameters : getAdditionalLinkNodes(request)) {
+                       HTMLNode linkNode = pageNode.headNode.addChild("link");
+                       for (Entry<String, String> parameter : linkNodeParameters.entrySet()) {
+                               linkNode.addAttribute(parameter.getKey(), parameter.getValue());
+                       }
+               }
                String shortcutIcon = getShortcutIcon();
                if (shortcutIcon != null) {
                        pageNode.addForwardLink("icon", shortcutIcon);
@@ -206,6 +216,17 @@ public class FreenetTemplatePage implements Page, LinkEnabledCallback {
                return null;
        }
 
+       /**
+        * Returns additional &lt;link&gt; nodes for the HTML’s &lt;head&gt; node.
+        *
+        * @param request
+        *            The request for which to return the link nodes
+        * @return All link nodes that should be added to the HTML head
+        */
+       protected List<Map<String, String>> getAdditionalLinkNodes(Request request) {
+               return Collections.emptyList();
+       }
+
        //
        // INTERFACE LinkEnabledCallback
        //