diff options
Diffstat (limited to 'BKUOnline/src/main')
5 files changed, 24 insertions, 10 deletions
diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/MoccaParameterBean.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/MoccaParameterBean.java index 0e2e4b02..4bba6947 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/MoccaParameterBean.java +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/MoccaParameterBean.java @@ -36,6 +36,8 @@ import java.util.Arrays; import java.util.Locale; import java.util.regex.Pattern; +import javax.servlet.ServletConfig; +import javax.servlet.ServletContext; import javax.servlet.http.HttpServletResponse; import org.apache.commons.configuration.Configuration; @@ -47,8 +49,8 @@ import at.gv.egiz.bku.utils.StreamUtil; public class MoccaParameterBean { - private final Logger log = LoggerFactory.getLogger(MoccaParameterBean.class); - + private static final Logger log = LoggerFactory.getLogger(MoccaParameterBean.class); + public static final String PARAM_UI_PAGE_P = "appletPage"; public static final String PARAM_APPLET_WIDTH = "appletWidth"; @@ -234,4 +236,15 @@ public class MoccaParameterBean { response.addHeader("P3P", P3P_POLICY); } } + + public static String getInitParameter(String name, ServletConfig config, + ServletContext context) { + String initVal = config.getInitParameter(name); + String contextVal = context.getInitParameter(config.getServletName() + "." + name); + log.debug("Reading init param " + name + ": " + initVal + + " - context param " + (config.getServletName() + "." + name) + ": " + contextVal); + if (contextVal != null) + return contextVal; + return initVal; + } } 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 9c531a3c..67253f24 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 @@ -63,12 +63,12 @@ public class ResultServlet extends HttpServlet { @Override public void init() throws ServletException { - String encoding = getServletConfig().getInitParameter("responseEncoding"); + String encoding = MoccaParameterBean.getInitParameter("responseEncoding", getServletConfig(), getServletContext()); if (encoding != null) { log.info("Init default responseEncoding to: {}.", encoding); responseEncoding = encoding; } - String url = getServletConfig().getInitParameter("expiredPageUrl"); + String url = MoccaParameterBean.getInitParameter("expiredPageUrl", getServletConfig(), getServletContext()); if (url != null) { // try { // expiredPageUrl = new URL(url).toString(); diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/UIServlet.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/UIServlet.java index 1a1c30d0..0b344f9d 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/UIServlet.java +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/UIServlet.java @@ -55,7 +55,7 @@ public class UIServlet extends HttpServlet { @Override public void init() throws ServletException { - String url = getServletConfig().getInitParameter("expiredPageUrl"); + String url = MoccaParameterBean.getInitParameter("expiredPageUrl", getServletConfig(), getServletContext()); if (url != null) { // try { // expiredPageUrl = new URL(url).toString(); @@ -99,7 +99,7 @@ public class UIServlet extends HttpServlet { MoccaParameterBean parameterBean = new MoccaParameterBean((HTTPBindingProcessor) bindingProcessor); req.setAttribute("moccaParam", parameterBean); - String uiPage = getServletConfig().getInitParameter("uiPage"); + String uiPage = MoccaParameterBean.getInitParameter("uiPage", getServletConfig(), getServletContext()); uiPage = parameterBean.getUIPage(uiPage); if (uiPage == null) { uiPage = "applet.jsp"; diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/WebRequestHandler.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/WebRequestHandler.java index 6accc5a1..2912fb02 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/WebRequestHandler.java +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/WebRequestHandler.java @@ -56,7 +56,7 @@ public class WebRequestHandler extends HttpServlet { @Override public void init() throws ServletException { - String url = getServletConfig().getInitParameter("uiRedirectUrl"); + String url = MoccaParameterBean.getInitParameter("uiRedirectUrl", getServletConfig(), getServletContext()); if (url != null) { uiRedirectUrl = url; log.info("Init uiRedirectUrl to: {}.", uiRedirectUrl); @@ -99,7 +99,7 @@ public class WebRequestHandler extends HttpServlet { } // create new binding processor - String protocol = getServletConfig().getInitParameter("protocol"); + String protocol = MoccaParameterBean.getInitParameter("protocol", getServletConfig(), getServletContext()); if (protocol == null || protocol.isEmpty()) { protocol = req.getScheme(); } diff --git a/BKUOnline/src/main/java/at/gv/egiz/mocca/id/DataURLServerServlet.java b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/DataURLServerServlet.java index 3e47fd79..7dd2cd22 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/mocca/id/DataURLServerServlet.java +++ b/BKUOnline/src/main/java/at/gv/egiz/mocca/id/DataURLServerServlet.java @@ -53,6 +53,7 @@ import at.gv.egiz.bku.binding.FormParameter; import at.gv.egiz.bku.binding.Id; import at.gv.egiz.bku.binding.InputDecoder; import at.gv.egiz.bku.binding.InputDecoderFactory; +import at.gv.egiz.bku.online.webapp.MoccaParameterBean; import at.gv.egiz.bku.slcommands.SLCommand; import at.gv.egiz.bku.slcommands.SLMarshallerFactory; import at.gv.egiz.bku.slcommands.SLResult; @@ -185,12 +186,12 @@ public class DataURLServerServlet extends HttpServlet { } // create new binding processor - String protocol = getServletConfig().getInitParameter("protocol"); + String protocol = MoccaParameterBean.getInitParameter("protocol", getServletConfig(), getServletContext()); if (protocol == null || protocol.isEmpty()) { protocol = req.getScheme(); } SAMLBindingProcessorImpl bindingProcessor = (SAMLBindingProcessorImpl) bindingProcessorManager - .createBindingProcessor(protocol, locale); + .createBindingProcessor(protocol, locale); if (bindingProcessor != null && respElement != null) { |