From: David ‘Bombe’ Roden Date: Wed, 13 Oct 2010 13:15:19 +0000 (+0200) Subject: Use new redirect exception. X-Git-Tag: 0.1-RC1~478 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=8276173b917c67f253c59f5ddf99b4deb155a870;p=Sone.git Use new redirect exception. --- 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; } /**