diff options
Diffstat (limited to 'BKUOnline')
-rw-r--r-- | BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java | 9 | ||||
-rw-r--r-- | BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java | 9 |
2 files changed, 17 insertions, 1 deletions
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()); |