Package org.springframework.web.context.support

Examples of org.springframework.web.context.support.StaticWebApplicationContext.refresh()


    MockServletContext sc = new MockServletContext();
    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.setServletContext(sc);
    wac.getDefaultListableBeanFactory().registerSingleton("sessionFactory", sf);
    wac.refresh();
    sc.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
    MockHttpServletRequest request = new MockHttpServletRequest(sc);
    MockHttpServletResponse response = new MockHttpServletResponse();

    MockFilterConfig filterConfig = new MockFilterConfig(wac.getServletContext(), "filter");
View Full Code Here


    MockServletContext sc = new MockServletContext();
    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.setServletContext(sc);
    wac.getDefaultListableBeanFactory().registerSingleton("persistenceManagerFactory", pmf);
    wac.getDefaultListableBeanFactory().registerSingleton("myPersistenceManagerFactory", pmf2);
    wac.refresh();
    sc.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
    MockHttpServletRequest request = new MockHttpServletRequest(sc);
    MockHttpServletResponse response = new MockHttpServletResponse();

    MockFilterConfig filterConfig = new MockFilterConfig(wac.getServletContext(), "filter");
View Full Code Here

  }

  private void setupStaticWebApplicationContext() {
    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.setServletContext(servletContext);
    wac.refresh();
    request.setAttribute(RequestContext.WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
    ajaxTilesView.setApplicationContext(wac);
  }

  public void testFullPageRendering() throws Exception {
View Full Code Here

  }

  private void setupStaticWebApplicationContext() {
    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.setServletContext(servletContext);
    wac.refresh();
    request.setAttribute(RequestContext.WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
    ajaxTilesView.setApplicationContext(wac);
  }

  public void testFullPageRendering() throws Exception {
View Full Code Here

  @Before
  public void setUp() {
    StaticWebApplicationContext context = new StaticWebApplicationContext();
    context.setServletContext(new MockServletContext());
    context.refresh();
    this.delegateViewResolver = createMock(ViewResolver.class);
    this.viewResolver = new LiteDeviceDelegatingViewResolver(delegateViewResolver);
    viewResolver.setApplicationContext(context);
    request.setRequestURI("/home");
    RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
View Full Code Here

  @Before
  public void setUp() {
    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.setServletContext(new MockServletContext());
    wac.refresh();

    this.renderer = EasyMock.createMock(Renderer.class);

    this.viewResolver = new TilesViewResolver();
    this.viewResolver.setRenderer(this.renderer);
View Full Code Here

  @Before
  public void setUp() throws Exception {
    MockServletContext servletContext = new MockServletContext();
    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.setServletContext(servletContext);
    wac.refresh();

    request = new MockHttpServletRequest();
    request.setAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);

    response = new MockHttpServletResponse();
View Full Code Here

    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.addPropertyValue(new PropertyValue("mappings", URL_KNOWN_ONLY_PARENT + "=parentHandler"));

    parent.registerSingleton("parentMapping", SimpleUrlHandlerMapping.class, pvs);
    parent.refresh();

    DispatcherServlet complexDispatcherServlet = new DispatcherServlet();
    // will have parent
    complexDispatcherServlet.setContextClass(ComplexWebApplicationContext.class);
    complexDispatcherServlet.setNamespace("test");
View Full Code Here

    assertHasStandardServletEnvironment(ctx);

    registerEnvironmentBeanDefinition(ctx);

    ctx.setEnvironment(prodWebEnv);
    ctx.refresh();

    assertHasEnvironment(ctx, prodWebEnv);
    assertEnvironmentBeanRegistered(ctx);
    assertEnvironmentAwareInvoked(ctx, prodWebEnv);
  }
View Full Code Here

    servletConfig.addInitParameter("pCommon", "pCommonConfigValue");
    servletConfig.addInitParameter("pConfig1", "pConfig1Value");

    StaticWebApplicationContext ctx = new StaticWebApplicationContext();
    ctx.setServletConfig(servletConfig);
    ctx.refresh();

    ConfigurableEnvironment environment = ctx.getEnvironment();
    MutablePropertySources propertySources = environment.getPropertySources();
    assertThat(propertySources.contains(StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME), is(true));
    assertThat(propertySources.contains(StandardServletEnvironment.SERVLET_CONFIG_PROPERTY_SOURCE_NAME), is(true));
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.