Package org.springframework.web.context.support

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


    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


  @Test
  public void controllerAdvice() throws Exception {
    StaticWebApplicationContext cxt = new StaticWebApplicationContext();
    cxt.registerSingleton("exceptionHandler", ApplicationExceptionHandler.class);
    cxt.refresh();

    ExceptionHandlerExceptionResolver resolver = new ExceptionHandlerExceptionResolver();
    resolver.setApplicationContext(cxt);
    resolver.afterPropertiesSet();
View Full Code Here

      }
    };

    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.getBeanFactory().registerSingleton("configurer", vc);
    wac.refresh();

    VelocityViewResolver vr = new VelocityViewResolver();
    vr.setPrefix("prefix_");
    vr.setSuffix("_suffix");
    vr.setApplicationContext(wac);
View Full Code Here

      }
    };

    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.getBeanFactory().registerSingleton("configurer", vc);
    wac.refresh();

    String toolbox = "org/springframework/web/servlet/view/velocity/toolbox.xml";

    VelocityViewResolver vr = new VelocityViewResolver();
    vr.setPrefix("prefix_");
View Full Code Here

      }
    };

    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.getBeanFactory().registerSingleton("configurer", vc);
    wac.refresh();

    String toolbox = "org/springframework/web/servlet/view/velocity/toolbox.xml";

    VelocityViewResolver vr = new VelocityViewResolver();
    vr.setViewClass(VelocityLayoutView.class);
View Full Code Here

      }
    };

    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.getBeanFactory().registerSingleton("configurer", vc);
    wac.refresh();

    VelocityLayoutViewResolver vr = new VelocityLayoutViewResolver();
    vr.setPrefix("prefix_");
    vr.setSuffix("_suffix");
    vr.setLayoutUrl("myLayoutUrl");
View Full Code Here

  private void setViewProperties(AbstractJasperReportsView view) {
    view.setUrl("/org/springframework/ui/jasperreports/DataSourceReport.jasper");
    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);
  }

}
View Full Code Here

  @Test
  public void updateTargetUrl() throws Exception {
    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.registerSingleton("requestDataValueProcessor", RequestDataValueProcessorWrapper.class);
    wac.setServletContext(new MockServletContext());
    wac.refresh();

    RequestDataValueProcessor mockProcessor = mock(RequestDataValueProcessor.class);
    wac.getBean(RequestDataValueProcessorWrapper.class).setRequestDataValueProcessor(mockProcessor);

    RedirectView rv = new RedirectView();
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

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.