X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=inline;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftemplate%2FRequestChangeFilter.java;h=ff677fb275f8e342faca0cd73b00c2b01913d20e;hb=d35ab97a494fd187d3b8fe6b3253b65e3427a077;hp=45d6ba781b0399828edb3cf30396c3e0507cd47a;hpb=a47643aed43d118ca68044f95451bb5374cdb332;p=Sone.git
diff --git a/src/main/java/net/pterodactylus/sone/template/RequestChangeFilter.java b/src/main/java/net/pterodactylus/sone/template/RequestChangeFilter.java
index 45d6ba7..ff677fb 100644
--- a/src/main/java/net/pterodactylus/sone/template/RequestChangeFilter.java
+++ b/src/main/java/net/pterodactylus/sone/template/RequestChangeFilter.java
@@ -1,5 +1,5 @@
/*
- * Sone - RequestChangeFilter.java - Copyright © 2010â2012 David Roden
+ * Sone - RequestChangeFilter.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
@@ -33,35 +33,17 @@ import net.pterodactylus.util.template.TemplateContext;
/**
* This filter expects a {@link FreenetRequest} as input and outputs a
* {@link URI} that is modified by the parameters. The name of the parameter is
- * handed in as ânameâ, the value may either be stored in âvalueâ, or in a
- * template variable whose key is stored in âkeyâ.
+ * handed in as ânameâ, the new value is stored in âvalueâ.
*
* @author David âBombeâ Roden
*/
public class RequestChangeFilter implements Filter {
- /**
- * {@inheritDoc}
- */
@Override
- public Object format(TemplateContext templateContext, Object data, Map parameters) {
+ public Object format(TemplateContext templateContext, Object data, Map parameters) {
FreenetRequest request = (FreenetRequest) data;
- String name = parameters.get("name");
- String nameKey = parameters.get("nameKey");
- if (nameKey != null) {
- name = String.valueOf(templateContext.get(nameKey));
- }
- String key = parameters.get("key");
- String value = null;
- if (key != null) {
- value = String.valueOf(templateContext.get(key));
- }
- if (value == null) {
- value = parameters.get("value");
- }
- if (value == null) {
- return request.getUri();
- }
+ String name = String.valueOf(parameters.get("name"));
+ String value = String.valueOf(parameters.get("value"));
Map values = new HashMap();
Collection parameterNames = request.getHttpRequest().getParameterNames();