From 8276173b917c67f253c59f5ddf99b4deb155a870 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 13 Oct 2010 15:15:19 +0200 Subject: [PATCH] Use new redirect exception. --- src/main/java/net/pterodactylus/sone/web/LoginPage.java | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/web/LoginPage.java b/src/main/java/net/pterodactylus/sone/web/LoginPage.java index e5ef128..7e99b32 100644 --- a/src/main/java/net/pterodactylus/sone/web/LoginPage.java +++ b/src/main/java/net/pterodactylus/sone/web/LoginPage.java @@ -51,18 +51,11 @@ public class LoginPage extends SoneTemplatePage { * {@inheritDoc} */ @Override - protected void processTemplate(Request request, Template template) { + protected void processTemplate(Request request, Template template) throws RedirectException { Set localSones = webInterface.core().localSones(); template.set("sones", localSones); - } - - /** - * {@inheritDoc} - */ - @Override - protected String getRedirectTarget(Request request) { if (request.getMethod() == Method.POST) { - String soneId = request.getHttpRequest().getParam("sone-id"); + String soneId = request.getHttpRequest().getPartAsStringFailsafe("sone-id", 100); Sone selectedSone = null; for (Sone sone : webInterface.core().localSones()) { if (sone.getId().equals(soneId)) { @@ -72,10 +65,9 @@ public class LoginPage extends SoneTemplatePage { } if (selectedSone != null) { setCurrentSone(request.getToadletContext(), selectedSone); - return "index.html"; + throw new RedirectException("index.html"); } } - return null; } /** -- 2.7.4