From cd8bc974aacc45f1f8ee4aa51f03e2f647dc8bc4 Mon Sep 17 00:00:00 2001 From: wbauer Date: Thu, 18 Dec 2008 10:34:26 +0000 Subject: fixed bug #368 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@254 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java | 9 ++++++++- .../main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java | 9 +++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'BKUOnline/src/main/java') diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java index 12166a5a..781e0832 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java @@ -50,6 +50,7 @@ public class BKURequestHandler extends SpringBKUServlet { private static final long serialVersionUID = 1L; public final static String REDIRECT_URL = "appletPage.jsp"; + public final static String REDIRECT_URL_SESSION_ATTRIBUTE="redirectUrl"; protected Log log = LogFactory.getLog(BKURequestHandler.class); @@ -170,7 +171,13 @@ public class BKURequestHandler extends SpringBKUServlet { log.debug("Using locale " + locale); session.setAttribute("locale", locale.toString()); } - + + // handle server side redirect url after processing + String redirectUrl = bindingProcessor.getRedirectURL(); + if ( redirectUrl != null) { + log.debug("Got redirect URL "+redirectUrl+". Deferring browser redirect."); + session.setAttribute(REDIRECT_URL_SESSION_ATTRIBUTE, redirectUrl); + } // TODO error if no dispatcher found RequestDispatcher dispatcher = getServletContext().getNamedDispatcher( BKU_APPLET_JSP); diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java index 9e69099d..36d41629 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java @@ -100,8 +100,17 @@ public class ResultServlet extends SpringBKUServlet { return; } + String redirectUrl = (String) session.getAttribute(BKURequestHandler.REDIRECT_URL_SESSION_ATTRIBUTE); + if (redirectUrl != null) { + log.debug("Executing deferred browser redirect to: "+redirectUrl); + resp.sendRedirect(redirectUrl); + session.invalidate(); + return; + } + if (bp.getRedirectURL() != null) { resp.sendRedirect(bp.getRedirectURL()); + session.invalidate(); return; } resp.setStatus(bp.getResponseCode()); -- cgit v1.2.3