From 20ab59a5882105d432854d7b797ef3325010b6cd Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 16 Sep 2011 13:27:39 +0200 Subject: [PATCH] Add method to parse an identity from an arbitrary parameter. --- src/main/java/net/pterodactylus/wotns/ui/web/BasicPage.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/pterodactylus/wotns/ui/web/BasicPage.java b/src/main/java/net/pterodactylus/wotns/ui/web/BasicPage.java index 85ad8b1..2921c7e 100644 --- a/src/main/java/net/pterodactylus/wotns/ui/web/BasicPage.java +++ b/src/main/java/net/pterodactylus/wotns/ui/web/BasicPage.java @@ -53,11 +53,15 @@ public class BasicPage extends FreenetTemplatePage { // protected OwnIdentity getOwnIdentity(FreenetRequest request) { + return getOwnIdentity(request, "ownIdentity"); + } + + protected OwnIdentity getOwnIdentity(FreenetRequest request, String parameterName) { if (request.getMethod() == Method.POST) { - String ownIdentityId = request.getHttpRequest().getPartAsStringFailsafe("ownIdentity", 43); + String ownIdentityId = request.getHttpRequest().getPartAsStringFailsafe(parameterName, 43); return identityManager.getOwnIdentity(ownIdentityId); } else if (request.getMethod() == Method.GET) { - String ownIdentityId = request.getHttpRequest().getParam("ownIdentity"); + String ownIdentityId = request.getHttpRequest().getParam(parameterName); return identityManager.getOwnIdentity(ownIdentityId); } return null; -- 2.7.4