From: David ‘Bombe’ Roden Date: Fri, 16 Sep 2011 11:27:39 +0000 (+0200) Subject: Add method to parse an identity from an arbitrary parameter. X-Git-Tag: 0.0.4^2~2 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=20ab59a5882105d432854d7b797ef3325010b6cd;p=WoTNS.git Add method to parse an identity from an arbitrary parameter. --- 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;