Example usage for javax.servlet ServletContext setInitParameter

List of usage examples for javax.servlet ServletContext setInitParameter

Introduction

In this page you can find the example usage for javax.servlet ServletContext setInitParameter.

Prototype

public boolean setInitParameter(String name, String value);

Source Link

Document

Sets the context initialization parameter with the given name and value on this ServletContext.

Usage

From source file:th.co.geniustree.testspringboot.spring.boot.webapp.config.WebInitializer.java

@Override
public void onStartup(ServletContext sc) throws ServletException {
    sc.setInitParameter("primefaces.CLIENT_SIDE_VALIDATION", "true");
    sc.setInitParameter("javax.faces.PROJECT_STATE", "Development");
}

From source file:com.vtxii.smallstuff.etl.filewatcher.Application.java

@Bean
public ServletContextInitializer initializer() {
    return new ServletContextInitializer() {
        @Override//w w w  .  jav  a2  s.  c  o m
        public void onStartup(ServletContext servletContext) throws ServletException {
            servletContext.setInitParameter("processor-class-name",
                    "com.vtxii.smallstuff.etl.filewatcher.DefaultProcessor");
            servletContext.setInitParameter("filter-class-name",
                    "com.vtxii.smallstuff.etl.filewatcher.DefaultFilter");
            servletContext.setInitParameter("directories", "/home/devuser/test;/home/devuser/test2");
            servletContext.setInitParameter("polling-interval", "10");
        }
    };
}

From source file:com.dm.platform.listener.PlatformServletContextListener.java

@Override
public void contextInitialized(ServletContextEvent sce) {
    System.out.println("contextInitialized");

    ServletContext sc = sce.getServletContext();
    sc.setInitParameter("contextConfigLocation", "/WEB-INF/applicationContext.xml");
    //    sc.addListener(ContextLoaderListener.class);
    FilterRegistration fr = sc.addFilter(DelegatingFilterProxy.class.getSimpleName(),
            DelegatingFilterProxy.class);
    fr.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, "/spring/*");

    ServletRegistration sr = sc.addServlet("spring", DispatcherServlet.class);
    sr.setInitParameter("contextConfigLocation",
            "/WEB-INF/dispatcher-servlet.xml /WEB-INF/platform-security.xml");
    sr.addMapping("/spring/*");

    fr = sc.addFilter(DynamicRegistFilter.class.getSimpleName(), DynamicRegistFilter.class);
    fr.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, "/platform/*");

}

From source file:org.lightadmin.logging.configurer.LightConfigurerServletContextInitializer.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    servletContext.setInitParameter(LIGHT_CONFIGURER_BASE_URL, configurerSettings.getApplicationBaseUrl());
    servletContext.setInitParameter(LIGHT_CONFIGURER_BACK_TO_SITE_URL, configurerSettings.getBackToSiteUrl());
    servletContext.setInitParameter(LIGHT_CONFIGURER_DEMO_MODE,
            Boolean.toString(configurerSettings.isDemoMode()));

    new LightConfigurerWebApplicationInitializer().onStartup(servletContext);
}

From source file:com.bentechapps.angularcrud.config.SpringApplicationInitializer.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    //Tell jersey-spring3 the context is already initialized

    servletContext.setInitParameter("contextConfigLocation", "NOTNULL");
    AnnotationConfigWebApplicationContext appContext = new AnnotationConfigWebApplicationContext();
    appContext.register(SpringApplication.class);
    servletContext.addListener(new ContextLoaderListener(appContext));
}

From source file:com.rockagen.gnext.main.BootStrap.java

public void setInitParameter(final ServletContext ctx) {
    // Spring log4j param
    ctx.setInitParameter("log4jConfigLocation", "classpath:log4j.properties");
    ctx.setInitParameter("log4jRefreshInterval", "60000");
}

From source file:org.statefulj.demo.ddd.config.AppInitializer.java

@Override
public void onStartup(ServletContext servletContext) {

    // Suppress the Jersey-Spring bridge from loading the appContext
    ////from   ww w  . j a v  a  2  s .  c  om
    servletContext.setInitParameter("contextConfigLocation", "<NONE>");
}

From source file:org.jhk.pulsing.web.config.WebAppInitializer.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    super.onStartup(servletContext);

    servletContext.setInitParameter("spring.profiles.active", "prod");
}

From source file:org.cloudfoundry.reconfiguration.spring.AutoReconfigurationServletContainerInitializer.java

@Override
public void onStartup(Set<Class<?>> c, ServletContext ctx) {
    this.logger.info("Initializing ServletContext with Auto-reconfiguration ApplicationContextInitializers");
    ctx.setInitParameter(GLOBAL_INITIALIZER_CLASSES_PARAM, APPLICATION_CONTEXT_INITIALIZERS);
}

From source file:com.miserablemind.butter.bootstrap.AppInitializer.java

/**
 * Implements {@link WebApplicationInitializer} onStartup to initialize the system.
 * It registers and configures {@link RootContext}, {@link WebSecurityContext}, and app specific contexts.
 * It also initializes the {@link Log4jConfigListener}.
 *
 * @param container ServletContext/*ww w.j  a v a 2s.c  o m*/
 */
@Override
public void onStartup(ServletContext container) {

    //Make the logger read settings from main properties file
    container.setInitParameter("log4jConfigLocation", "classpath:system.properties");
    container.addListener(new Log4jConfigListener());

    //Root Spring application context
    AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
    rootContext.register(RootContext.class);
    container.addListener(new ContextLoaderListener(rootContext));

    //Spring Security context
    AnnotationConfigWebApplicationContext securityContext = new AnnotationConfigWebApplicationContext();
    securityContext.register(WebSecurityContext.class);
    DelegatingFilterProxy filterProxy = new DelegatingFilterProxy("springSecurityFilterChain");
    container.addFilter("springSecurityFilterChain", filterProxy).addMappingForUrlPatterns(null, false, "*");

    //Dispatcher Servlet context
    AnnotationConfigWebApplicationContext dispatcherContext = new AnnotationConfigWebApplicationContext();
    dispatcherContext.register(ButterAppMVCContext.class);

    //Register and map the dispatcher servlet
    DispatcherServlet dispatcherServlet = new DispatcherServlet(dispatcherContext);
    ServletRegistration.Dynamic dispatcher = container.addServlet("mvc-dispatcher", dispatcherServlet);
    dispatcher.setLoadOnStartup(1);
    dispatcher.addMapping("/");

}