From f095a6dcd1e36beaf828a7c5da934d7c50529b48 Mon Sep 17 00:00:00 2001 From: clemenso Date: Tue, 10 Mar 2009 10:07:28 +0000 Subject: AppletPageAlternative git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@314 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../egiz/bku/online/webapp/BKURequestHandler.java | 49 ++++++++++++---------- 1 file changed, 26 insertions(+), 23 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 4b275298..68a57fb5 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 @@ -81,10 +81,10 @@ public class BKURequestHandler extends SpringBKUServlet { IdFactory.getInstance().createId(session.getId())); if (bp != null) { log.debug("Found binding processor, using this one"); - String appletPage = (String) session.getAttribute(APPLET_PAGE_P); - RequestDispatcher dispatcher = getServletContext().getNamedDispatcher(appletPage); - log.debug("forward to applet " + appletPage); - dispatcher.forward(req, resp); + String appletPage = getStringFromStream( + ((HTTPBindingProcessor) bp).getFormData(APPLET_PAGE_P), + req.getCharacterEncoding()); + getDispatcher(appletPage).forward(req, resp); return; } log.debug("Did not find a binding processor, creating new ..."); @@ -124,14 +124,6 @@ public class BKURequestHandler extends SpringBKUServlet { log.trace("Trying to find applet parameters in request"); - String appletPage = getStringFromStream(bindingProcessor - .getFormData(APPLET_PAGE_P), charset); - if (appletPage == null) { - appletPage = APPLET_PAGE_DEFAULT; - } - log.trace("requested appletPage " + appletPage); - session.setAttribute(APPLET_PAGE_P, appletPage); - String width = getStringFromStream(bindingProcessor .getFormData("appletWidth"), charset); String height = getStringFromStream(bindingProcessor @@ -197,17 +189,10 @@ public class BKURequestHandler extends SpringBKUServlet { log.info("Got redirect URL "+redirectUrl+". Deferring browser redirect."); session.setAttribute(REDIRECT_URL_SESSION_ATTRIBUTE, redirectUrl); } - RequestDispatcher dispatcher = getServletContext().getNamedDispatcher( - appletPage); - if (dispatcher == null) { - log.warn("requested AppletPage " + appletPage + " not configured"); - appletPage = APPLET_PAGE_DEFAULT; - session.setAttribute(APPLET_PAGE_P, APPLET_PAGE_DEFAULT); - dispatcher = getServletContext().getNamedDispatcher( - appletPage); - } - log.debug("forward to applet " + appletPage); - dispatcher.forward(req, resp); + + String appletPage = getStringFromStream(bindingProcessor + .getFormData(APPLET_PAGE_P), charset); + getDispatcher(appletPage).forward(req, resp); } @Override @@ -215,4 +200,22 @@ public class BKURequestHandler extends SpringBKUServlet { throws ServletException, java.io.IOException { doPost(req, resp); } + + private RequestDispatcher getDispatcher(String appletPage) { + RequestDispatcher dispatcher = null; + if (appletPage != null) { + log.trace("requested appletPage " + appletPage); + dispatcher = getServletContext().getNamedDispatcher(appletPage); + } + if (dispatcher == null) { + log.trace("no appletPage requested or appletPage not configured, using default"); + appletPage = APPLET_PAGE_DEFAULT; + dispatcher = getServletContext().getNamedDispatcher(appletPage); + } +// session.setAttribute(APPLET_PAGE_P, appletPage); + log.debug("forward to applet " + appletPage); + + return dispatcher; + } + } -- cgit v1.2.3