X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftemplate%2FGetPagePlugin.java;h=f79b06ee647f6aef5f84cfdfd0cbaca57721fd6a;hb=18a698e6a649539b6a4870d5928f91bcb9d37f35;hp=1b36c0519d865219635a2519a4e3108d5f913e8c;hpb=e22ec3673d5b9ced3522395d936def235a4b0505;p=Sone.git
diff --git a/src/main/java/net/pterodactylus/sone/template/GetPagePlugin.java b/src/main/java/net/pterodactylus/sone/template/GetPagePlugin.java
index 1b36c05..f79b06e 100644
--- a/src/main/java/net/pterodactylus/sone/template/GetPagePlugin.java
+++ b/src/main/java/net/pterodactylus/sone/template/GetPagePlugin.java
@@ -1,5 +1,5 @@
/*
- * Sone - GetPagePlugin.java - Copyright © 2010 David Roden
+ * Sone - GetPagePlugin.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
@@ -19,23 +19,21 @@ package net.pterodactylus.sone.template;
import java.util.Map;
-import net.pterodactylus.sone.web.page.Page.Request;
-import net.pterodactylus.util.template.DataProvider;
+import net.pterodactylus.sone.web.page.FreenetRequest;
import net.pterodactylus.util.template.Plugin;
+import net.pterodactylus.util.template.TemplateContext;
+import net.pterodactylus.util.web.Request;
/**
- * Extracts a page number from a {@link Request}âs parameters and stores it in a
- * {@link DataProvider}.
+ * Extracts a page number from a {@link Request}âs parameters and stores it in
+ * the {@link TemplateContext}.
*
* @author David âBombeâ Roden
*/
public class GetPagePlugin implements Plugin {
- /**
- * {@inheritDoc}
- */
@Override
- public void execute(DataProvider dataProvider, Map parameters) {
+ public void execute(TemplateContext templateContext, Map parameters) {
String requestKey = parameters.get("request");
String parameter = parameters.get("parameter");
String pageKey = parameters.get("key");
@@ -50,7 +48,7 @@ public class GetPagePlugin implements Plugin {
pageKey = "page";
}
- Request request = (Request) dataProvider.get(requestKey);
+ FreenetRequest request = (FreenetRequest) templateContext.get(requestKey);
String pageString = request.getHttpRequest().getParam(parameter);
int page = 0;
try {
@@ -58,7 +56,7 @@ public class GetPagePlugin implements Plugin {
} catch (NumberFormatException nfe1) {
/* ignore. */
}
- dataProvider.set(pageKey, page);
+ templateContext.set(pageKey, page);
}
}