Examples of GenericWebApplicationContext


Examples of org.springframework.web.context.support.GenericWebApplicationContext

          ServletContextHandler.SECURITY | ServletContextHandler.SESSIONS);

      //Changing session cookie name to avoid conflicts
      root.getSessionHandler().getSessionManager().setSessionCookie("AMBARISESSIONID");

      GenericWebApplicationContext springWebAppContext = new GenericWebApplicationContext();
      springWebAppContext.setServletContext(root.getServletContext());
      springWebAppContext.setParent(springAppContext);
      /* Configure web app context */
      root.setResourceBase(configs.getWebAppDir());

      root.getServletContext().setAttribute(
          WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
View Full Code Here

Examples of org.springframework.web.context.support.GenericWebApplicationContext

    }
   
    public final void testNewApplicationContext() {
        final ClassLoader classLoader = ClassUtils.getDefaultClassLoader();
        final GenericApplicationContext parent = new GenericApplicationContext();
        final GenericWebApplicationContext applicationContext = loader.newApplicationContext(null, parent, new SimpleRootModuleDefinition(projectNames, new String[]{"loc"}), classLoader);

        assertNotNull(applicationContext);
        assertNotNull(applicationContext.getBeanFactory());
        assertSame(classLoader, applicationContext.getClassLoader());
        assertSame(servletContext, applicationContext.getServletContext());
    }
View Full Code Here

Examples of org.springframework.web.context.support.GenericWebApplicationContext

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        servletContext = createMock(ServletContext.class);
        moduleDefinition = new SimpleModuleDefinition("mymodule");
        context = new GenericWebApplicationContext();
        webAttributeQualifier = new DefaultWebAttributeQualifier();
    }
View Full Code Here

Examples of org.springframework.web.context.support.GenericWebApplicationContext

* @author Phil Zoio
*/
public class WebPlaceholderDelegatingContextLoader implements DelegatingContextLoader {

  public ConfigurableApplicationContext loadApplicationContext(ApplicationContext parent, ModuleDefinition definition) {
    GenericWebApplicationContext context = new GenericWebApplicationContext();
    context.refresh();
    return context;
  }
View Full Code Here

Examples of org.springframework.web.context.support.GenericWebApplicationContext

  protected ModuleManagementFacade createModuleManagementFacade(ServletContext servletContext) {
    String[] locations = getBootstrapContextLocations(servletContext);
    logger.info("Loading bootstrap context from locations " + Arrays.toString(locations));

    final DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
    final GenericWebApplicationContext applicationContext = new GenericWebApplicationContext(beanFactory);
    applicationContext.setServletContext(servletContext);

    XmlBeanDefinitionReader definitionReader = new XmlBeanDefinitionReader(beanFactory);
    for (int i = 0; i < locations.length; i++) {
      definitionReader.loadBeanDefinitions(new ClassPathResource(locations[i]));
    }
    applicationContext.refresh();

    return ObjectUtils.cast(applicationContext.getBean("moduleManagementFacade"), ModuleManagementFacade.class);
  }
View Full Code Here

Examples of org.springframework.web.context.support.GenericWebApplicationContext

        }
       
        final DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
        beanFactory.setBeanClassLoader(classLoader);
       
        final GenericWebApplicationContext context = newApplicationContext(
                moduleDefinition,
                parent,
                classLoader,
                wrappedServletContext,
                beanFactory);
View Full Code Here

Examples of org.springframework.web.context.support.GenericWebApplicationContext

            ApplicationContext parent,
            ClassLoader classLoader,
            ServletContext servletContext,
            final DefaultListableBeanFactory beanFactory) {
       
        final GenericWebApplicationContext context = new GenericWebApplicationContext(beanFactory);
        context.setServletContext(servletContext);
        context.setClassLoader(classLoader);
       
        context.setParent(parent);
        final String displayName = ModuleLoaderUtils.getDisplayName(moduleDefinition, context);
        context.setDisplayName(displayName);
        return context;
    }
View Full Code Here

Examples of org.springframework.web.context.support.GenericWebApplicationContext

        }
       
        final DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
        beanFactory.setBeanClassLoader(classLoader);

        final GenericWebApplicationContext context = new GenericWebApplicationContext(beanFactory);
        context.setParent(parent);
        context.setServletContext(wrappedServletContext);
        context.setClassLoader(classLoader);
        context.setDisplayName(ModuleLoaderUtils.getDisplayName(moduleDefinition, context));

        return context;
    }
View Full Code Here

Examples of org.springframework.web.context.support.GenericWebApplicationContext

        super.setUp();
        factoryBean = new JspServletFactoryBean();
        factoryBean.setServletName("jspServlet");
        servletContext = new AttributeServletContext();
        factoryBean.setServletContext(servletContext);
        factoryBean.setApplicationContext(new GenericWebApplicationContext());
        Thread.currentThread().setContextClassLoader(null);
    }
View Full Code Here

Examples of org.springframework.web.context.support.GenericWebApplicationContext

       
        String[] locations = getBootstrapContextLocations(servletContext);
        logger.info("Loading bootstrap context from locations " + Arrays.toString(locations));

        final DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
        final GenericWebApplicationContext applicationContext = new GenericWebApplicationContext(beanFactory);
        applicationContext.setServletContext(servletContext);
        applicationContext.setParent(parent);

        XmlBeanDefinitionReader definitionReader = new XmlBeanDefinitionReader(beanFactory);
        for (int i = 0; i < locations.length; i++) {
            definitionReader.loadBeanDefinitions(new ClassPathResource(locations[i]));
        }
        applicationContext.refresh();

        return ObjectUtils.cast(applicationContext.getBean("moduleManagementFacade"), ModuleManagementFacade.class);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.