Example usage for javax.servlet ServletRegistration.Dynamic addMapping

List of usage examples for javax.servlet ServletRegistration.Dynamic addMapping

Introduction

In this page you can find the example usage for javax.servlet ServletRegistration.Dynamic addMapping.

Prototype

public Set<String> addMapping(String... urlPatterns);

Source Link

Document

Adds a servlet mapping with the given URL patterns for the Servlet represented by this ServletRegistration.

Usage

From source file:com.dominion.salud.nomenclator.configuration.NOMENCLATORInitializer.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
    ctx.scan("com.dominion.salud.nomenclator.configuration");
    ctx.setServletContext(servletContext);
    ctx.refresh();/* w w  w .ja v a2  s .  c  o m*/

    logger.info("     Registrando servlets de configuracion");
    ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher",
            new DispatcherServlet(ctx));
    dispatcher.setInitParameter("contextClass", ctx.getClass().getName());
    dispatcher.setLoadOnStartup(1);
    logger.info("          Agregando mapping: /");
    dispatcher.addMapping("/");
    logger.info("          Agregando mapping: /controller/*");
    dispatcher.addMapping("/controller/*");
    logger.info("          Agregando mapping: /services/*");
    dispatcher.addMapping("/services/*");
    servletContext.addListener(new ContextLoaderListener(ctx));
    logger.info("     Servlets de configuracion registrados correctamente");

    // Configuracion general
    logger.info("     Iniciando la configuracion del modulo");
    NOMENCLATORConstantes._HOME = StringUtils.endsWith(servletContext.getRealPath("/"), File.separator)
            ? servletContext.getRealPath("/")
            : servletContext.getRealPath("/") + File.separator;
    NOMENCLATORConstantes._TEMP = NOMENCLATORConstantes._HOME + "WEB-INF" + File.separator + "temp"
            + File.separator;
    NOMENCLATORConstantes._VERSION = ResourceBundle.getBundle("version").getString("version");
    NOMENCLATORConstantes._LOGS = NOMENCLATORConstantes._HOME + "WEB-INF" + File.separator + "classes"
            + File.separator + "logs";
    NOMENCLATORConstantes._CONTEXT_NAME = servletContext.getServletContextName();
    NOMENCLATORConstantes._CONTEXT_PATH = servletContext.getContextPath();
    NOMENCLATORConstantes._CONTEXT_SERVER = servletContext.getServerInfo();
    NOMENCLATORConstantes._ENABLE_TECHNICAL_INFORMATION = StringUtils.isNotBlank(
            ResourceBundle.getBundle("application").getString("nomenclator.enable.technical.information"))
                    ? Boolean.parseBoolean(ResourceBundle.getBundle("application")
                            .getString("nomenclator.enable.technical.information"))
                    : false;
    PropertyConfigurator.configureAndWatch("log4j");

    logger.info("          Configuracion general del sistema");
    logger.info("               nomenclator.home: " + NOMENCLATORConstantes._HOME);
    logger.info("               nomenclator.temp: " + NOMENCLATORConstantes._TEMP);
    logger.info("               nomenclator.version: " + NOMENCLATORConstantes._VERSION);
    logger.info("               nomenclator.logs: " + NOMENCLATORConstantes._LOGS);
    logger.info("               nomenclator.context.name: " + NOMENCLATORConstantes._CONTEXT_NAME);
    logger.info("               nomenclator.context.path: " + NOMENCLATORConstantes._CONTEXT_PATH);
    logger.info("               nomenclator.context.server: " + NOMENCLATORConstantes._CONTEXT_SERVER);
    logger.info("          Parametrizacion del sistema");
    logger.info("               nomenclator.enable.technical.information: "
            + NOMENCLATORConstantes._ENABLE_TECHNICAL_INFORMATION);
    logger.info("     Modulo configurado correctamente");
    logger.info("MODULO INICIADO CORRECTAMENTE");
}

From source file:com.haulmont.cuba.web.sys.singleapp.SingleAppWebContextLoader.java

protected void registerIdpServlet(ServletContext servletContext) {
    String serviceProvidersUrls = AppContext.getProperty(IDP_SERVICE_PROVIDERS_URLS);
    if (StringUtils.isEmpty(serviceProvidersUrls)) {
        log.debug("No service providers were found. IDP Servlet will not be started");
        return;/*  www.  j  ava 2 s . c om*/
    }

    CubaIdpServlet idpServlet = new SingleAppIdpServlet(dependencyJars);
    try {
        idpServlet.init(new CubaServletConfig("idp", servletContext));
    } catch (ServletException e) {
        throw new RuntimeException("An error occurred while initializing idp servlet", e);
    }

    ServletRegistration.Dynamic idpServletRegistration = servletContext.addServlet("idp", idpServlet);
    idpServletRegistration.setLoadOnStartup(4);
    idpServletRegistration.addMapping("/idp/*");

    DelegatingFilterProxy idpSpringSecurityFilterChain = new DelegatingFilterProxy();
    idpSpringSecurityFilterChain
            .setContextAttribute("org.springframework.web.servlet.FrameworkServlet.CONTEXT.idp");
    idpSpringSecurityFilterChain.setTargetBeanName("springSecurityFilterChain");

    FilterRegistration.Dynamic idpSpringSecurityFilterChainReg = servletContext
            .addFilter("idpSpringSecurityFilterChain", idpSpringSecurityFilterChain);

    idpSpringSecurityFilterChainReg.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true,
            "/idp/*");
}

From source file:com.haulmont.cuba.web.sys.singleapp.SingleAppWebContextLoader.java

protected void registerRestApiServlet(ServletContext servletContext) {
    CubaRestApiServlet cubaRestApiServlet = new SingleAppRestApiServlet(dependencyJars);
    try {/*w ww.j  a  v  a2s .c  om*/
        cubaRestApiServlet.init(new CubaServletConfig("rest_api", servletContext));
    } catch (ServletException e) {
        throw new RuntimeException("An error occurred while initializing dispatcher servlet", e);
    }
    ServletRegistration.Dynamic cubaRestApiServletReg = servletContext.addServlet("rest_api",
            cubaRestApiServlet);
    cubaRestApiServletReg.setLoadOnStartup(2);
    cubaRestApiServletReg.addMapping("/rest/*");

    DelegatingFilterProxy restSpringSecurityFilterChain = new DelegatingFilterProxy();
    restSpringSecurityFilterChain
            .setContextAttribute("org.springframework.web.servlet.FrameworkServlet.CONTEXT.rest_api");
    restSpringSecurityFilterChain.setTargetBeanName("springSecurityFilterChain");

    FilterRegistration.Dynamic restSpringSecurityFilterChainReg = servletContext
            .addFilter("restSpringSecurityFilterChain", restSpringSecurityFilterChain);
    restSpringSecurityFilterChainReg.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true,
            "/rest/*");
}

From source file:com.haulmont.cuba.web.sys.singleapp.SingleAppWebContextLoader.java

protected void registerDispatchServlet(ServletContext servletContext) {
    CubaDispatcherServlet cubaDispatcherServlet = new SingleAppDispatcherServlet(dependencyJars);
    try {/*from  w w  w.j  a va2s  .  co m*/
        cubaDispatcherServlet.init(new CubaServletConfig("dispatcher", servletContext));
    } catch (ServletException e) {
        throw new RuntimeException("An error occurred while initializing dispatcher servlet", e);
    }
    ServletRegistration.Dynamic cubaDispatcherServletReg = servletContext.addServlet("dispatcher",
            cubaDispatcherServlet);
    cubaDispatcherServletReg.setLoadOnStartup(1);
    cubaDispatcherServletReg.addMapping("/dispatch/*");
}

From source file:com.haulmont.cuba.web.sys.singleapp.SingleAppWebContextLoader.java

protected void registerAppServlet(ServletContext servletContext) {
    CubaApplicationServlet cubaServlet = new CubaApplicationServlet();
    cubaServlet.setClassLoader(Thread.currentThread().getContextClassLoader());
    try {/*  w w  w.  ja  v a  2  s.c  om*/
        cubaServlet.init(new CubaServletConfig("app_servlet", servletContext));
    } catch (ServletException e) {
        throw new RuntimeException("An error occurred while initializing app_servlet servlet", e);
    }
    ServletRegistration.Dynamic cubaServletReg = servletContext.addServlet("app_servlet", cubaServlet);
    cubaServletReg.setLoadOnStartup(0);
    cubaServletReg.setAsyncSupported(true);
    cubaServletReg.addMapping("/*");
}

From source file:fr.univlorraine.mondossierweb.Initializer.java

/**
 * @see org.springframework.web.WebApplicationInitializer#onStartup(javax.servlet.ServletContext)
 *//*www . j a  v a 2 s.  com*/
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    addContextParametersToSystemProperties(servletContext);

    /* Configure les sessions */
    Set<SessionTrackingMode> sessionTrackingModes = new HashSet<SessionTrackingMode>();
    sessionTrackingModes.add(SessionTrackingMode.COOKIE);
    servletContext.setSessionTrackingModes(sessionTrackingModes);
    servletContext.addListener(new HttpSessionListener() {
        @Override
        public void sessionCreated(HttpSessionEvent httpSessionEvent) {
            // sans nouvelle requte, on garde la session active 4 minutes
            httpSessionEvent.getSession().setMaxInactiveInterval(240);
        }

        @Override
        public void sessionDestroyed(HttpSessionEvent httpSessionEvent) {
        }
    });
    /* Gestion des sessions dans Atmosphere (Push Vaadin) */
    servletContext.addListener(SessionSupport.class);

    /* Configure Spring */
    AnnotationConfigWebApplicationContext springContext = new AnnotationConfigWebApplicationContext();
    if (!Boolean.valueOf(servletContext.getInitParameter(Constants.SERVLET_PARAMETER_PRODUCTION_MODE))) {
        springContext.getEnvironment().setActiveProfiles(DEBUG_PROFILE);
    }
    springContext.register(SpringConfig.class);
    servletContext.addListener(new ContextLoaderListener(springContext));
    servletContext.addListener(new RequestContextListener());

    /* Filtre Spring Security */
    FilterRegistration.Dynamic springSecurityFilterChain = servletContext.addFilter("springSecurityFilterChain",
            DelegatingFilterProxy.class);
    springSecurityFilterChain.addMappingForUrlPatterns(null, false, "/*");

    /* Filtre passant l'utilisateur courant  Logback */
    FilterRegistration.Dynamic userMdcServletFilter = servletContext.addFilter("userMdcServletFilter",
            UserMdcServletFilter.class);
    userMdcServletFilter.addMappingForUrlPatterns(null, false, "/*");

    /* Filtre Spring Mobile permettant de dtecter le device */
    FilterRegistration.Dynamic springMobileServletFilter = servletContext
            .addFilter("deviceResolverRequestFilter", DeviceResolverRequestFilter.class);
    springMobileServletFilter.addMappingForUrlPatterns(null, false, "/*");

    /* Servlet Spring-Vaadin */
    //ServletRegistration.Dynamic springVaadinServlet = servletContext.addServlet("springVaadin", JMeterServlet.class);
    //ServletRegistration.Dynamic springVaadinServlet = servletContext.addServlet("springVaadin", SpringVaadinServlet.class);
    ServletRegistration.Dynamic springVaadinServlet = servletContext.addServlet("springVaadin",
            fr.univlorraine.mondossierweb.utils.MdwSpringVaadinServlet.class);
    springVaadinServlet.setLoadOnStartup(1);
    springVaadinServlet.addMapping("/*");
    /* Dfini le bean UI */
    //springVaadinServlet.setInitParameter(Constants.SERVLET_PARAMETER_UI_PROVIDER, "fr.univlorraine.mondossierweb.MdwUIProvider");
    /* Utilise les messages Spring pour les messages d'erreur Vaadin (cf. http://vaadin.xpoft.ru/#system_messages) */
    springVaadinServlet.setInitParameter("systemMessagesBeanName", "DEFAULT");
    /* Dfini la frquence du heartbeat en secondes (cf. https://vaadin.com/book/vaadin7/-/page/application.lifecycle.html#application.lifecycle.ui-expiration) */
    springVaadinServlet.setInitParameter(Constants.SERVLET_PARAMETER_HEARTBEAT_INTERVAL, String.valueOf(30));

    /* Configure le Push */
    springVaadinServlet.setInitParameter(Constants.SERVLET_PARAMETER_PUSH_MODE,
            Boolean.valueOf(servletContext.getInitParameter("enablePush")) ? PushMode.AUTOMATIC.name()
                    : PushMode.DISABLED.name());

    /* Active le support des servlet 3 et des requtes asynchrones (cf. https://vaadin.com/wiki/-/wiki/Main/Working+around+push+issues) */
    springVaadinServlet.setInitParameter(ApplicationConfig.WEBSOCKET_SUPPORT_SERVLET3, String.valueOf(true));
    /* Active le support des requtes asynchrones */
    springVaadinServlet.setAsyncSupported(true);
    /* Ajoute l'interceptor Atmosphere permettant de restaurer le SecurityContext dans le SecurityContextHolder (cf. https://groups.google.com/forum/#!msg/atmosphere-framework/8yyOQALZEP8/ZCf4BHRgh_EJ) */
    springVaadinServlet.setInitParameter(ApplicationConfig.ATMOSPHERE_INTERCEPTORS,
            RecoverSecurityContextAtmosphereInterceptor.class.getName());

    /* Spring-Vaadin Touchkit Servlet  */
    ServletRegistration.Dynamic springTouchkitVaadinServlet = servletContext.addServlet("springTouchkitVaadin",
            MDWTouchkitServlet.class);
    //springTouchkitVaadinServlet.setLoadOnStartup(1);
    springTouchkitVaadinServlet.addMapping("/m/*");
    /* Dfini le bean UI */
    //springTouchkitVaadinServlet.setInitParameter(Constants.SERVLET_PARAMETER_UI_PROVIDER, "fr.univlorraine.mondossierweb.MdwTouchkitUIProvider");
    /* Utilise les messages Spring pour les messages d'erreur Vaadin (cf. http://vaadin.xpoft.ru/#system_messages) */
    springTouchkitVaadinServlet.setInitParameter("systemMessagesBeanName", "DEFAULT");
    springTouchkitVaadinServlet.setInitParameter(Constants.PARAMETER_WIDGETSET,
            "fr.univlorraine.mondossierweb.AppWidgetset");

    /* Configure le Push */
    springTouchkitVaadinServlet.setInitParameter(Constants.SERVLET_PARAMETER_PUSH_MODE,
            PushMode.DISABLED.name());
    /* Active le support des servlet 3 et des requtes asynchrones (cf. https://vaadin.com/wiki/-/wiki/Main/Working+around+push+issues) */
    springTouchkitVaadinServlet.setInitParameter(ApplicationConfig.WEBSOCKET_SUPPORT_SERVLET3,
            String.valueOf(true));
    /* Active le support des requtes asynchrones */
    springTouchkitVaadinServlet.setAsyncSupported(true);
    /* Ajoute l'interceptor Atmosphere permettant de restaurer le SecurityContext dans le SecurityContextHolder (cf. https://groups.google.com/forum/#!msg/atmosphere-framework/8yyOQALZEP8/ZCf4BHRgh_EJ) */
    springTouchkitVaadinServlet.setInitParameter(ApplicationConfig.ATMOSPHERE_INTERCEPTORS,
            RecoverSecurityContextAtmosphereInterceptor.class.getName());

}

From source file:com.dominion.salud.mpr.configuration.MPRInitializer.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
    ctx.scan("com.dominion.salud.mpr.configuration");
    ctx.setServletContext(servletContext);
    System.setProperty("mpr.conf.home", findConfigurationAndLogger(ctx));
    ctx.refresh();/*w ww. j a  v a2  s. c o m*/

    ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher",
            new DispatcherServlet(ctx));
    dispatcher.setLoadOnStartup(1);
    dispatcher.addMapping("/");
    dispatcher.addMapping("/controller/*");
    dispatcher.addMapping("/services/*");
    servletContext.addListener(new ContextLoaderListener(ctx));

    // Configuracion GENERAL DEL MODULO
    MPRConstantes._MPR_HOME = StringUtils.endsWith(servletContext.getRealPath("/"), File.separator)
            ? servletContext.getRealPath("/")
            : servletContext.getRealPath("/") + File.separator;
    MPRConstantes._MPR_CONF_HOME = ctx.getEnvironment().getProperty("mpr.conf.home");
    MPRConstantes._MPR_VERSION = ResourceBundle.getBundle("version").getString("version");
    MPRConstantes._MPR_RESOURCES = MPRConstantes._MPR_HOME + "resources" + File.separator;
    MPRConstantes._MPR_TEMP = MPRConstantes._MPR_HOME + "WEB-INF" + File.separator + "temp" + File.separator;
    MPRConstantes._MPR_CONTEXT_NAME = servletContext.getServletContextName();
    MPRConstantes._MPR_CONTEXT_PATH = servletContext.getContextPath();
    MPRConstantes._MPR_CONTEXT_SERVER = servletContext.getServerInfo();

    // Configuracion de LOGS DEL MODULO
    if (StringUtils.isBlank(
            ((FileAppender) org.apache.log4j.Logger.getRootLogger().getAppender("LOGFILE")).getFile())) {
        ((FileAppender) org.apache.log4j.Logger.getRootLogger().getAppender("LOGFILE"))
                .setFile(MPRConstantes._MPR_HOME + "WEB-INF" + File.separator + "classes" + File.separator
                        + "logs" + File.separator + "mpr-desktop.log");
    }
    MPRConstantes._MPR_LOGS = new File(
            ((FileAppender) org.apache.log4j.Logger.getRootLogger().getAppender("LOGFILE")).getFile())
                    .getParent();

    // Parametrizacion GENERAL DEL SISTEMA
    MPRConstantes._ENABLE_TECHNICAL_INFORMATION = StringUtils
            .isNotBlank(ctx.getEnvironment().getProperty("mpr.enable.technical.information"))
                    ? Boolean.parseBoolean(ctx.getEnvironment().getProperty("mpr.enable.technical.information"))
                    : false;

    // Parametrizacion de CONEXION A EMPI
    MPRConstantes._EMPI_ENABLE = StringUtils.isNotBlank(ctx.getEnvironment().getProperty("mpr.empi.enable"))
            ? Boolean.parseBoolean(ctx.getEnvironment().getProperty("mpr.empi.enable"))
            : false;
    MPRConstantes._EMPI_USUARIO = StringUtils.isNotBlank(ctx.getEnvironment().getProperty("mpr.empi.usuario"))
            ? ctx.getEnvironment().getProperty("mpr.empi.usuario")
            : "";
    MPRConstantes._EMPI_SISTEMA = StringUtils.isNotBlank(ctx.getEnvironment().getProperty("mpr.empi.sistema"))
            ? ctx.getEnvironment().getProperty("mpr.empi.sistema")
            : "";
    MPRConstantes._EMPI_URL = StringUtils.isNotBlank(ctx.getEnvironment().getProperty("mpr.empi.url"))
            ? ctx.getEnvironment().getProperty("mpr.empi.url")
            : "";

    // Parametrizacion de TAREAS PROGRAMADAS
    MPRConstantes._TASK_BUZON_IN_PROCESS_MESSAGES = StringUtils
            .isNotBlank(ctx.getEnvironment().getProperty("mpr.task.buzon.in.process.messages"))
                    ? ctx.getEnvironment().getProperty("mpr.task.buzon.in.process.messages")
                    : MPRConstantes._TASK_BUZON_IN_PROCESS_MESSAGES;
    MPRConstantes._TASK_BUZON_OUT_PROCESS_MESSAGES = StringUtils
            .isNotBlank(ctx.getEnvironment().getProperty("mpr.task.buzon.out.process.messages"))
                    ? ctx.getEnvironment().getProperty("mpr.task.buzon.out.process.messages")
                    : MPRConstantes._TASK_BUZON_OUT_PROCESS_MESSAGES;
    MPRConstantes._TASK_BUZON_IN_HIS_CLEAN = StringUtils
            .isNotBlank(ctx.getEnvironment().getProperty("mpr.task.buzon.in.his.clean"))
                    ? ctx.getEnvironment().getProperty("mpr.task.buzon.in.his.clean")
                    : MPRConstantes._TASK_BUZON_IN_HIS_CLEAN;
    MPRConstantes._TASK_BUZON_OUT_HIS_CLEAN = StringUtils
            .isNotBlank(ctx.getEnvironment().getProperty("mpr.task.buzon.out.his.clean"))
                    ? ctx.getEnvironment().getProperty("mpr.task.buzon.out.his.clean")
                    : MPRConstantes._TASK_BUZON_OUT_HIS_CLEAN;
    MPRConstantes._TASK_BUZON_IN_HIS_CLEAN_OLD = StringUtils
            .isNotBlank(ctx.getEnvironment().getProperty("mpr.task.buzon.in.his.clean.old"))
                    ? Integer.parseInt(ctx.getEnvironment().getProperty("mpr.task.buzon.in.his.clean.old"))
                    : MPRConstantes._TASK_BUZON_IN_HIS_CLEAN_OLD;
    MPRConstantes._TASK_BUZON_OUT_HIS_CLEAN_OLD = StringUtils
            .isNotBlank(ctx.getEnvironment().getProperty("mpr.task.buzon.out.his.clean.old"))
                    ? Integer.parseInt(ctx.getEnvironment().getProperty("mpr.task.buzon.out.his.clean.old"))
                    : MPRConstantes._TASK_BUZON_OUT_HIS_CLEAN_OLD;
    MPRConstantes._TASK_BUZON_IN_CLEAN = StringUtils
            .isNotBlank(ctx.getEnvironment().getProperty("mpr.task.buzon.in.clean"))
                    ? ctx.getEnvironment().getProperty("mpr.task.buzon.in.clean")
                    : MPRConstantes._TASK_BUZON_IN_CLEAN;
    MPRConstantes._TASK_BUZON_OUT_CLEAN = StringUtils
            .isNotBlank(ctx.getEnvironment().getProperty("mpr.task.buzon.out.clean"))
                    ? ctx.getEnvironment().getProperty("mpr.task.buzon.out.clean")
                    : MPRConstantes._TASK_BUZON_OUT_CLEAN;
    MPRConstantes._TASK_BUZON_ERRORES_CLEAN = StringUtils
            .isNotBlank(ctx.getEnvironment().getProperty("mpr.task.buzon.errores.clean"))
                    ? ctx.getEnvironment().getProperty("mpr.task.buzon.errores.clean")
                    : MPRConstantes._TASK_BUZON_ERRORES_CLEAN;

    logger.info("Iniciando el modulo de [" + MPRConstantes._MPR_CONTEXT_NAME + "]");
    logger.debug("     Configuracion GENERAL DEL MODULO");
    logger.debug("          mpr.home: " + MPRConstantes._MPR_HOME);
    logger.debug("          mpr.conf.home: " + MPRConstantes._MPR_CONF_HOME);
    logger.debug("          mpr.version: " + MPRConstantes._MPR_VERSION);
    logger.debug("          mpr.resources: " + MPRConstantes._MPR_RESOURCES);
    logger.debug("          mpr.temp: " + MPRConstantes._MPR_TEMP);
    logger.debug("          mpr.logs: " + MPRConstantes._MPR_LOGS);
    logger.debug("          mpr.logs.file: "
            + ((FileAppender) org.apache.log4j.Logger.getRootLogger().getAppender("LOGFILE")).getFile());
    logger.debug("          mpr.context.name: " + MPRConstantes._MPR_CONTEXT_NAME);
    logger.debug("          mpr.context.path: " + MPRConstantes._MPR_CONTEXT_PATH);
    logger.debug("          mpr.context.server: " + MPRConstantes._MPR_CONTEXT_SERVER);
    logger.debug("          java.version: " + ctx.getEnvironment().getProperty("java.version"));
    logger.debug("");
    logger.debug("     Parametrizacion GENERAL DEL SISTEMA");
    logger.debug("          mpr.enable.technical.information: " + MPRConstantes._ENABLE_TECHNICAL_INFORMATION);
    logger.debug("     Parametrizacion de CONEXION A EMPI");
    logger.debug("          mpr.empi.enable: " + MPRConstantes._EMPI_ENABLE);
    logger.debug("          mpr.empi.usuario: " + MPRConstantes._EMPI_USUARIO);
    logger.debug("          mpr.empi.sistema: " + MPRConstantes._EMPI_SISTEMA);
    logger.debug("          mpr.empi.url: " + MPRConstantes._EMPI_URL);
    logger.debug("     Parametrizacion de TAREAS PROGRAMADAS");
    logger.debug(
            "          mpr.task.buzon.in.process.messages: " + MPRConstantes._TASK_BUZON_IN_PROCESS_MESSAGES);
    logger.debug(
            "          mpr.task.buzon.out.process.messages: " + MPRConstantes._TASK_BUZON_OUT_PROCESS_MESSAGES);
    logger.debug("          mpr.task.buzon.in.his.clean: " + MPRConstantes._TASK_BUZON_IN_HIS_CLEAN);
    logger.debug("          mpr.task.buzon.out.his.clean: " + MPRConstantes._TASK_BUZON_OUT_HIS_CLEAN);
    logger.debug("          mpr.task.buzon.in.his.clean.old: " + MPRConstantes._TASK_BUZON_IN_HIS_CLEAN_OLD);
    logger.debug("          mpr.task.buzon.out.his.clean.old: " + MPRConstantes._TASK_BUZON_OUT_HIS_CLEAN_OLD);
    logger.debug("          mpr.task.buzon.in.clean: " + MPRConstantes._TASK_BUZON_IN_CLEAN);
    logger.debug("          mpr.task.buzon.out.clean: " + MPRConstantes._TASK_BUZON_OUT_CLEAN);
    logger.debug("          mpr.task.buzon.errores.clean: " + MPRConstantes._TASK_BUZON_ERRORES_CLEAN);
    logger.debug("     Variables de ENTORNO de utilidad");
    logger.debug("          catalina.home: " + ctx.getEnvironment().getProperty("catalina.home"));
    logger.debug("          jboss.home.dir: " + ctx.getEnvironment().getProperty("jboss.home.dir"));
    logger.info("Modulo [" + MPRConstantes._MPR_CONTEXT_NAME + "] iniciado correctamente");
}

From source file:org.lightadmin.core.config.LightAdminWebApplicationInitializer.java

private void registerLightAdminDispatcher(final ServletContext servletContext) {
    final AnnotationConfigWebApplicationContext webApplicationContext = lightAdminApplicationContext(
            servletContext);/*from   w  ww  .j  av a2 s.c om*/

    final DispatcherServlet lightAdminDispatcher = new DispatcherServlet(webApplicationContext);
    lightAdminDispatcher.setDetectAllViewResolvers(false);

    ServletRegistration.Dynamic lightAdminDispatcherRegistration = servletContext
            .addServlet(LIGHT_ADMIN_DISPATCHER_NAME, lightAdminDispatcher);
    lightAdminDispatcherRegistration.setLoadOnStartup(3);
    lightAdminDispatcherRegistration.addMapping(dispatcherUrlMapping(lightAdminBaseUrl(servletContext)));
}

From source file:com.dominion.salud.pedicom.configuration.PEDICOMInitializer.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
    ctx.scan("com.dominion.salud.pedicom.configuration");
    ctx.setServletContext(servletContext);
    PEDICOMConstantes._NOMBRE_CONFIG = servletContext.getInitParameter("NOMBRE_CONFIG");
    System.setProperty("pedicom.conf.home", findConfigurationAndLogger(ctx));
    ctx.refresh();// w  w  w .  j  av  a  2s.c  o  m

    // Spring Dispatcher
    ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher",
            new DispatcherServlet(ctx));
    dispatcher.setInitParameter("contextClass", ctx.getClass().getName());
    dispatcher.setLoadOnStartup(1);
    dispatcher.addMapping("/");
    dispatcher.addMapping("/controller/*");
    servletContext.addListener(new ContextLoaderListener(ctx));

    // Configuracion general
    PEDICOMConstantes._HOME = StringUtils.endsWith(servletContext.getRealPath("/"), File.separator)
            ? servletContext.getRealPath("/")
            : servletContext.getRealPath("/") + File.separator;
    PEDICOMConstantes._CONF_HOME = ctx.getEnvironment().getProperty("pedicom.conf.home");
    PEDICOMConstantes._TEMP = PEDICOMConstantes._HOME + "WEB-INF" + File.separator + "temp" + File.separator;
    PEDICOMConstantes._VERSION = ResourceBundle.getBundle("version").getString("version");
    PEDICOMConstantes._LOGS = PEDICOMConstantes._HOME + "WEB-INF" + File.separator + "classes" + File.separator
            + "logs";
    PEDICOMConstantes._CONTEXT_NAME = servletContext.getServletContextName();
    PEDICOMConstantes._CONTEXT_PATH = servletContext.getContextPath();
    PEDICOMConstantes._CONTEXT_SERVER = servletContext.getServerInfo();
    PEDICOMConstantes._ENABLE_TECHNICAL_INFORMATION = StringUtils.isNotBlank(
            ResourceBundle.getBundle("application").getString("pedicom.enable.technical.information"))
                    ? Boolean.parseBoolean(ResourceBundle.getBundle("application")
                            .getString("pedicom.enable.technical.information"))
                    : false;
    PEDICOMConstantes._SCHEDULER_SEND_MAIL_CRON = StringUtils
            .isNotBlank(ResourceBundle.getBundle("application").getString("pedicom_scheduler_send_mail_cron"))
                    ? PEDICOMConstantes._SCHEDULER_SEND_MAIL_CRON = ResourceBundle.getBundle("application")
                            .getString("pedicom_scheduler_send_mail_cron")
                    : PEDICOMConstantes._SCHEDULER_SEND_MAIL_CRON;
    PEDICOMConstantes._SCHEDULER_UPDATE_EXISTENCIAS_CRON = StringUtils.isNotBlank(
            ResourceBundle.getBundle("application").getString("pedicom_scheduler_update_existencias_cron"))
                    ? PEDICOMConstantes._SCHEDULER_SEND_MAIL_CRON = ResourceBundle.getBundle("application")
                            .getString("pedicom_scheduler_update_existencias_cron")
                    : PEDICOMConstantes._SCHEDULER_UPDATE_EXISTENCIAS_CRON;

    // Configuracion de LOGS DEL MODULO
    if (StringUtils.isBlank(
            ((FileAppender) org.apache.log4j.Logger.getRootLogger().getAppender("LOGFILE")).getFile())) {
        ((FileAppender) org.apache.log4j.Logger.getRootLogger().getAppender("LOGFILE"))
                .setFile(PEDICOMConstantes._HOME + "WEB-INF" + File.separator + "classes" + File.separator
                        + "logs" + File.separator + "mpr-desktop.log");
    }
    PEDICOMConstantes._LOGS = new File(
            ((FileAppender) org.apache.log4j.Logger.getRootLogger().getAppender("LOGFILE")).getFile())
                    .getParent();

    Environment env = ctx.getEnvironment();

    XmlUnmarshaler xml = new XmlUnmarshaler();
    Datos datos = (Datos) xml.unmarshal();
    logger.info("          Datasources");
    for (Datasources dat : datos.getDatasources()) {
        if (dat.getNombreDatasource().equals("Central")) {
            PEDICOMConstantes.EXISTENCIAS_EXISTE = true;
        }
        logger.info("               codCentro: " + dat.getCodCentro());
        logger.info("               nombreDatasource: " + dat.getNombreDatasource());
        logger.info("               driverClassName: " + dat.getDriverClassName());
        logger.info("               jndi: " + dat.getJndi());
        logger.info("               url: " + dat.getUrl());
        logger.info("               username: " + dat.getUsername());
        logger.info("               usernameEmail: " + dat.getUsernameEmail());
        logger.info("               passwordEmail: " + dat.getPasswordEmail());
        logger.info("               from: " + dat.getFrom());
        logger.info("               host: " + dat.getHost());
        logger.info("               port: " + dat.getPort());
        logger.info("               TLS: " + dat.getTLS());
        logger.info("               SSL: " + dat.getSSL());
    }
    //        ctx.refresh();
    //        PropertyConfigurator.configureAndWatch("log4j");

    logger.info("          Configuracion general del sistema");
    logger.info("               pedicom.home: " + PEDICOMConstantes._HOME);
    logger.info("               pedicom.conf.home: " + PEDICOMConstantes._CONF_HOME);
    logger.info("               pedicom.temp: " + PEDICOMConstantes._TEMP);
    logger.info("               pedicom.version: " + PEDICOMConstantes._VERSION);
    logger.info("               pedicom.logs: " + PEDICOMConstantes._LOGS);
    logger.info("               pedicom.context.name: " + PEDICOMConstantes._CONTEXT_NAME);
    logger.info("               pedicom.context.path: " + PEDICOMConstantes._CONTEXT_PATH);
    logger.info("               pedicom.context.server: " + PEDICOMConstantes._CONTEXT_SERVER);
    logger.info("          Parametrizacion del sistema");
    logger.info("               pedicom.enable.technical.information: "
            + PEDICOMConstantes._ENABLE_TECHNICAL_INFORMATION);
    logger.info(
            "               pedicom_scheduler_send_mail_cron: " + PEDICOMConstantes._SCHEDULER_SEND_MAIL_CRON);
    logger.info("               pedicom_scheduler_update_existencias_cron: "
            + PEDICOMConstantes._SCHEDULER_UPDATE_EXISTENCIAS_CRON);
    logger.info("     Modulo configurado correctamente");
    logger.info("MODULO INICIADO CORRECTAMENTE");
}

From source file:org.lightadmin.core.config.LightAdminWebApplicationInitializer.java

private void registerLightAdminDispatcherRedirector(final ServletContext servletContext) {
    final DispatcherRedirectorServlet handlerServlet = new DispatcherRedirectorServlet();

    ServletRegistration.Dynamic lightAdminDispatcherRedirectorRegistration = servletContext
            .addServlet(LIGHT_ADMIN_DISPATCHER_REDIRECTOR_NAME, handlerServlet);
    lightAdminDispatcherRedirectorRegistration.setLoadOnStartup(4);
    lightAdminDispatcherRedirectorRegistration.addMapping(lightAdminBaseUrl(servletContext));
}