X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=inline;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpage%2FFreenetTemplatePage.java;h=40e19b1a67aaf29ba60939156cd996f179e710aa;hb=ebd6ea3fcae4bb6a58f4ddd5d5aa1ac90bdc5a31;hp=8096a6ab48ebd94d58dd78bce109651605e1da8f;hpb=0df5e91852f737d760c5a9f54c5667309fbadcc2;p=Sone.git
diff --git a/src/main/java/net/pterodactylus/sone/web/page/FreenetTemplatePage.java b/src/main/java/net/pterodactylus/sone/web/page/FreenetTemplatePage.java
index 8096a6a..40e19b1 100644
--- a/src/main/java/net/pterodactylus/sone/web/page/FreenetTemplatePage.java
+++ b/src/main/java/net/pterodactylus/sone/web/page/FreenetTemplatePage.java
@@ -1,5 +1,5 @@
/*
- * Sone - FreenetTemplatePage.java - Copyright © 2010 David Roden
+ * Sone - FreenetTemplatePage.java - Copyright © 2010â2013 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
@@ -17,8 +17,11 @@
package net.pterodactylus.sone.web.page;
+import static java.util.logging.Logger.getLogger;
+
import java.io.IOException;
import java.io.StringWriter;
+import java.net.URI;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -27,7 +30,6 @@ import java.util.Map.Entry;
import java.util.logging.Level;
import java.util.logging.Logger;
-import net.pterodactylus.util.logging.Logging;
import net.pterodactylus.util.template.Template;
import net.pterodactylus.util.template.TemplateContext;
import net.pterodactylus.util.template.TemplateContextFactory;
@@ -47,10 +49,10 @@ import freenet.support.HTMLNode;
*
* @author David âBombeâ Roden
*/
-public class FreenetTemplatePage implements Page, LinkEnabledCallback {
+public class FreenetTemplatePage implements FreenetPage, LinkEnabledCallback {
/** The logger. */
- private static final Logger logger = Logging.getLogger(FreenetTemplatePage.class);
+ private static final Logger logger = getLogger("Sone.Web.Freenet");
/** The path of the page. */
private final String path;
@@ -99,6 +101,7 @@ public class FreenetTemplatePage implements Page, LinkEnabledCal
* The request to serve
* @return The title of the page
*/
+ @SuppressWarnings("static-method")
protected String getPageTitle(FreenetRequest request) {
return null;
}
@@ -154,7 +157,7 @@ public class FreenetTemplatePage implements Page, 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, String.format("Template was rendered in %.2fms.", (finish - start) / 1000000.0));
} catch (RedirectException re1) {
return new RedirectResponse(re1.getTarget());
}
@@ -174,6 +177,7 @@ public class FreenetTemplatePage implements Page, LinkEnabledCal
*
* @return Additional style sheets to load
*/
+ @SuppressWarnings("static-method")
protected Collection getStyleSheets() {
return Collections.emptySet();
}
@@ -183,6 +187,7 @@ public class FreenetTemplatePage implements Page, LinkEnabledCal
*
* @return The URL of the shortcut icon, or {@code null} for no icon
*/
+ @SuppressWarnings("static-method")
protected String getShortcutIcon() {
return null;
}
@@ -204,10 +209,9 @@ public class FreenetTemplatePage implements Page, 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 +231,7 @@ public class FreenetTemplatePage implements Page, 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 +243,7 @@ public class FreenetTemplatePage implements Page, 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