Package org.springframework.web.context.support

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


  public void testDispatchActionSupportWithRootContext() throws ServletException {
    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.addMessage("test", Locale.getDefault(), "testmessage");
    final ServletContext servletContext = new MockServletContext();
    wac.setServletContext(servletContext);
    wac.refresh();
    servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);

    ActionServlet actionServlet = new ActionServlet() {
      public ServletContext getServletContext() {
        return servletContext;
View Full Code Here


  public void testLookupDispatchActionSupportWithContextLoaderPlugIn() throws ServletException {
    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.addMessage("test", Locale.getDefault(), "testmessage");
    final ServletContext servletContext = new MockServletContext();
    wac.setServletContext(servletContext);
    wac.refresh();
    servletContext.setAttribute(ContextLoaderPlugIn.SERVLET_CONTEXT_PREFIX, wac);

    ActionServlet actionServlet = new ActionServlet() {
      public ServletContext getServletContext() {
        return servletContext;
View Full Code Here

  public void testLookupDispatchActionSupportWithRootContext() throws ServletException {
    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.addMessage("test", Locale.getDefault(), "testmessage");
    final ServletContext servletContext = new MockServletContext();
    wac.setServletContext(servletContext);
    wac.refresh();
    servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);

    ActionServlet actionServlet = new ActionServlet() {
      public ServletContext getServletContext() {
        return servletContext;
View Full Code Here

    AbstractJasperReportsView view = getViewImplementation();
    view.setUrl(url);
    StaticWebApplicationContext ac = new StaticWebApplicationContext();
    ac.setServletContext(new MockServletContext());
    ac.addMessage("page", Locale.GERMAN, "MeineSeite");
    ac.refresh();
    request.setAttribute(DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE, ac);
    view.setApplicationContext(ac);
    return view;
  }
View Full Code Here

    MutablePropertyValues pvs2 = new MutablePropertyValues();
    pvs2.addPropertyValue(new PropertyValue("url", "/example2.jsp"));
    wac.registerSingleton("example2", JstlView.class, pvs2);
    BeanNameViewResolver vr = new BeanNameViewResolver();
    vr.setApplicationContext(wac);
    wac.refresh();

    View view = vr.resolveViewName("example1", Locale.getDefault());
    assertEquals("Correct view class", InternalResourceView.class, view.getClass());
    assertEquals("Correct URL", "/example1.jsp", ((InternalResourceView) view).getUrl());
View Full Code Here

  }

  private void doTestUrlBasedViewResolverWithoutPrefixes(UrlBasedViewResolver vr) throws Exception {
    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.setServletContext(new MockServletContext());
    wac.refresh();
    vr.setApplicationContext(wac);
    vr.setContentType("myContentType");
    vr.setRequestContextAttribute("rc");

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

  }

  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

    MockServletContext sc = new MockServletContext();
    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.setServletContext(sc);
    wac.getDefaultListableBeanFactory().registerSingleton("sessionFactory", sf);
    wac.getDefaultListableBeanFactory().registerSingleton("mySessionFactory", sf2);
    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("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("sessionFactory", sf);
    wac.getDefaultListableBeanFactory().registerSingleton("mySessionFactory", sf2);
    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

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.