Suppress warnings on potentiall-static methods.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / page / FreenetTemplatePage.java
index 8096a6a..97ee53b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Sone - FreenetTemplatePage.java - Copyright © 2010 David Roden
+ * Sone - FreenetTemplatePage.java - Copyright © 2010–2012 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
@@ -19,6 +19,7 @@ package net.pterodactylus.sone.web.page;
 
 import java.io.IOException;
 import java.io.StringWriter;
+import java.net.URI;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
@@ -47,7 +48,7 @@ import freenet.support.HTMLNode;
  *
  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
  */
-public class FreenetTemplatePage implements Page<FreenetRequest>, LinkEnabledCallback {
+public class FreenetTemplatePage implements FreenetPage, LinkEnabledCallback {
 
        /** The logger. */
        private static final Logger logger = Logging.getLogger(FreenetTemplatePage.class);
@@ -99,6 +100,7 @@ public class FreenetTemplatePage implements Page<FreenetRequest>, LinkEnabledCal
         *            The request to serve
         * @return The title of the page
         */
+       @SuppressWarnings("static-method")
        protected String getPageTitle(FreenetRequest request) {
                return null;
        }
@@ -154,7 +156,7 @@ public class FreenetTemplatePage implements Page<FreenetRequest>, LinkEnabledCal
                        long start = System.nanoTime();
                        processTemplate(request, templateContext);
                        long finish = System.nanoTime();
-                       logger.log(Level.FINEST, "Template was rendered in " + ((finish - start) / 1000) / 1000.0 + "ms.");
+                       logger.log(Level.FINEST, "Template was rendered in %dms.", ((finish - start) / 1000) / 1000.0);
                } catch (RedirectException re1) {
                        return new RedirectResponse(re1.getTarget());
                }
@@ -174,6 +176,7 @@ public class FreenetTemplatePage implements Page<FreenetRequest>, LinkEnabledCal
         *
         * @return Additional style sheets to load
         */
+       @SuppressWarnings("static-method")
        protected Collection<String> getStyleSheets() {
                return Collections.emptySet();
        }
@@ -183,6 +186,7 @@ public class FreenetTemplatePage implements Page<FreenetRequest>, LinkEnabledCal
         *
         * @return The URL of the shortcut icon, or {@code null} for no icon
         */
+       @SuppressWarnings("static-method")
        protected String getShortcutIcon() {
                return null;
        }
@@ -204,10 +208,9 @@ public class FreenetTemplatePage implements Page<FreenetRequest>, LinkEnabledCal
 
        /**
         * This method will be called after
-        * {@link #processTemplate(net.pterodactylus.sone.web.page.Page.Request, TemplateContext)}
-        * has processed the template and the template was rendered. This method
-        * will not be called if
-        * {@link #processTemplate(net.pterodactylus.sone.web.page.Page.Request, TemplateContext)}
+        * {@link #processTemplate(FreenetRequest, TemplateContext)} has processed
+        * the template and the template was rendered. This method will not be
+        * called if {@link #processTemplate(FreenetRequest, TemplateContext)}
         * throws a {@link RedirectException}!
         *
         * @param request
@@ -227,6 +230,7 @@ public class FreenetTemplatePage implements Page<FreenetRequest>, LinkEnabledCal
         *            The request that is processed
         * @return The URL to redirect to, or {@code null} to not redirect
         */
+       @SuppressWarnings("static-method")
        protected String getRedirectTarget(FreenetRequest request) {
                return null;
        }
@@ -238,6 +242,7 @@ public class FreenetTemplatePage implements Page<FreenetRequest>, LinkEnabledCal
         *            The request for which to return the link nodes
         * @return All link nodes that should be added to the HTML head
         */
+       @SuppressWarnings("static-method")
        protected List<Map<String, String>> getAdditionalLinkNodes(FreenetRequest request) {
                return Collections.emptyList();
        }
@@ -249,10 +254,19 @@ public class FreenetTemplatePage implements Page<FreenetRequest>, LinkEnabledCal
         * @return {@code true} if this page should only be allowed for hosts with
         *         full access, {@code false} to allow this page for any host
         */
+       @SuppressWarnings("static-method")
        protected boolean isFullAccessOnly() {
                return false;
        }
 
+       /**
+        * {@inheritDoc}
+        */
+       @Override
+       public boolean isLinkExcepted(URI link) {
+               return false;
+       }
+
        //
        // INTERFACE LinkEnabledCallback
        //
@@ -268,7 +282,7 @@ public class FreenetTemplatePage implements Page<FreenetRequest>, LinkEnabledCal
        /**
         * Exception that can be thrown to signal that a subclassed {@link Page}
         * wants to redirect the user during the
-        * {@link FreenetTemplatePage#processTemplate(net.pterodactylus.sone.web.page.Page.Request, TemplateContext)}
+        * {@link FreenetTemplatePage#processTemplate(FreenetRequest, TemplateContext)}
         * method call.
         *
         * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>