Package org.springframework.web.context.support

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


  }

  private void doTestUrlBasedViewResolverWithPrefixes(UrlBasedViewResolver vr) throws Exception {
    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.setServletContext(new MockServletContext());
    wac.refresh();
    vr.setPrefix("/WEB-INF/");
    vr.setSuffix(".jsp");
    vr.setApplicationContext(wac);

    View view = vr.resolveViewName("example1", Locale.getDefault());
View Full Code Here


  @Test
  public void testInternalResourceViewResolverWithAttributes() throws Exception {
    MockServletContext sc = new MockServletContext();
    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.setServletContext(sc);
    wac.refresh();
    InternalResourceViewResolver vr = new InternalResourceViewResolver();
    Properties props = new Properties();
    props.setProperty("key1", "value1");
    vr.setAttributes(props);
    Map map = new HashMap();
View Full Code Here

    MockServletContext sc = new MockServletContext();
    final StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.registerSingleton("myBean", TestBean.class);
    wac.registerSingleton("myBean2", TestBean.class);
    wac.setServletContext(sc);
    wac.refresh();
    InternalResourceViewResolver vr = new InternalResourceViewResolver();
    Properties props = new Properties();
    props.setProperty("key1", "value1");
    vr.setAttributes(props);
    Map map = new HashMap();
View Full Code Here

    MockServletContext sc = new MockServletContext();
    final StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.registerSingleton("myBean", TestBean.class);
    wac.registerSingleton("myBean2", TestBean.class);
    wac.setServletContext(sc);
    wac.refresh();
    InternalResourceViewResolver vr = new InternalResourceViewResolver();
    Properties props = new Properties();
    props.setProperty("key1", "value1");
    vr.setAttributes(props);
    Map map = new HashMap();
View Full Code Here

  @Test
  public void modelAttributeAdviceInParentContext() throws Exception {
    StaticWebApplicationContext parent = new StaticWebApplicationContext();
    parent.registerSingleton("maa", ModelAttributeAdvice.class);
    parent.refresh();
    this.webAppContext.setParent(parent);
    this.webAppContext.refresh();

    HandlerMethod handlerMethod = handlerMethod(new SimpleController(), "handle");
    this.handlerAdapter.afterPropertiesSet();
View Full Code Here

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

    this.renderer = mock(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

    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

    MockServletContext sc = new MockServletContext();
    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.setServletContext(sc);
    wac.getDefaultListableBeanFactory().registerSingleton("entityManagerFactory", factory);
    wac.getDefaultListableBeanFactory().registerSingleton("myEntityManagerFactory", factory2);
    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("entityManagerFactory", factory);
    wac.getDefaultListableBeanFactory().registerSingleton("myEntityManagerFactory", factory2);
    wac.refresh();
    sc.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);

    MockFilterConfig filterConfig = new MockFilterConfig(wac.getServletContext(), "filter");
    MockFilterConfig filterConfig2 = new MockFilterConfig(wac.getServletContext(), "filter2");
    filterConfig2.addInitParameter("entityManagerFactoryBeanName", "myEntityManagerFactory");
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.