From a9dc7e094a8732f9826ab77648758dd39adc7324 Mon Sep 17 00:00:00 2001 From: Thomas Knall Date: Wed, 4 Feb 2015 13:54:32 +0100 Subject: Add logging for automatic servlet registration. --- .../modules/stork/STORKWebApplicationInitializer.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'id/server/modules/module-stork/src/main/java') diff --git a/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/STORKWebApplicationInitializer.java b/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/STORKWebApplicationInitializer.java index 7478a57c3..c54c9a26d 100644 --- a/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/STORKWebApplicationInitializer.java +++ b/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/STORKWebApplicationInitializer.java @@ -4,6 +4,8 @@ import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletRegistration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.web.WebApplicationInitializer; import at.gv.egovernment.moa.id.auth.servlet.ProcessEngineSignalServlet; @@ -23,15 +25,24 @@ import at.gv.egovernment.moa.id.auth.servlet.ProcessEngineSignalServlet; * @see ProcessEngineSignalServlet */ public class STORKWebApplicationInitializer implements WebApplicationInitializer { + + private Logger log = LoggerFactory.getLogger(getClass()); + + private static final String SIGNAL_SERVLET_NAME = "ProcessEngineSignal"; + + private void addMapping(ServletRegistration servletRegistration, String mapping) { + log.debug("Adding mapping '{}' to servlet '{}' ({}).", mapping, SIGNAL_SERVLET_NAME, servletRegistration.getClassName()); + servletRegistration.addMapping(mapping); + } @Override public void onStartup(ServletContext servletContext) throws ServletException { - ServletRegistration servletRegistration = servletContext.getServletRegistration("ProcessEngineSignal"); + ServletRegistration servletRegistration = servletContext.getServletRegistration(SIGNAL_SERVLET_NAME); if (servletRegistration == null) { - throw new IllegalStateException("Servlet 'ProcessEngineSignal' expected to be registered."); + throw new IllegalStateException("Servlet '" + SIGNAL_SERVLET_NAME + "' expected to be registered (e.g. by web.xml)."); } - servletRegistration.addMapping("/PEPSConnectorWithLocalSigning"); - servletRegistration.addMapping("/PEPSConnector"); + addMapping(servletRegistration, "/PEPSConnectorWithLocalSigning"); + addMapping(servletRegistration, "/PEPSConnector"); } } -- cgit v1.2.3