Package org.springframework.web.context.support

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


  public void testModelFormController() throws Exception {
    DispatcherPortlet portlet = new DispatcherPortlet() {
      protected ApplicationContext createPortletApplicationContext(ApplicationContext parent) throws BeansException {
        GenericWebApplicationContext wac = new GenericWebApplicationContext();
        wac.registerBeanDefinition("controller", new RootBeanDefinition(MyModelFormController.class));
        wac.refresh();
        return wac;
      }

      protected void render(ModelAndView mv, RenderRequest request, RenderResponse response) throws Exception {
        new TestView().render(mv.getViewName(), mv.getModel(), request, response);
View Full Code Here


        GenericWebApplicationContext wac = new GenericWebApplicationContext();
        wac.registerBeanDefinition("controller", new RootBeanDefinition(MyCommandProvidingFormController.class));
        RootBeanDefinition adapterDef = new RootBeanDefinition(AnnotationMethodHandlerAdapter.class);
        adapterDef.getPropertyValues().addPropertyValue("webBindingInitializer", new MyWebBindingInitializer());
        wac.registerBeanDefinition("handlerAdapter", adapterDef);
        wac.refresh();
        return wac;
      }

      protected void render(ModelAndView mv, RenderRequest request, RenderResponse response) throws Exception {
        new TestView().render(mv.getViewName(), mv.getModel(), request, response);
View Full Code Here

        wac.registerBeanDefinition("controller2", new RootBeanDefinition(MyOtherTypedCommandProvidingFormController.class));
        RootBeanDefinition adapterDef = new RootBeanDefinition(AnnotationMethodHandlerAdapter.class);
        adapterDef.getPropertyValues().addPropertyValue("webBindingInitializer", new MyWebBindingInitializer());
        adapterDef.getPropertyValues().addPropertyValue("customArgumentResolver", new MySpecialArgumentResolver());
        wac.registerBeanDefinition("handlerAdapter", adapterDef);
        wac.refresh();
        return wac;
      }
      protected void render(ModelAndView mv, RenderRequest request, RenderResponse response) throws Exception {
        new TestView().render(mv.getViewName(), mv.getModel(), request, response);
      }
View Full Code Here

  public void testBinderInitializingCommandProvidingFormController() throws Exception {
    DispatcherPortlet portlet = new DispatcherPortlet() {
      protected ApplicationContext createPortletApplicationContext(ApplicationContext parent) throws BeansException {
        GenericWebApplicationContext wac = new GenericWebApplicationContext();
        wac.registerBeanDefinition("controller", new RootBeanDefinition(MyBinderInitializingCommandProvidingFormController.class));
        wac.refresh();
        return wac;
      }

      protected void render(ModelAndView mv, RenderRequest request, RenderResponse response) throws Exception {
        new TestView().render(mv.getViewName(), mv.getModel(), request, response);
View Full Code Here

  public void testConfigureExporterParametersWithEncodingFromPropertiesFile() throws Exception {
    GenericWebApplicationContext ac = new GenericWebApplicationContext();
    ac.setServletContext(new MockServletContext());
    BeanDefinitionReader reader = new PropertiesBeanDefinitionReader(ac);
    reader.loadBeanDefinitions(new ClassPathResource("view.properties", getClass()));
    ac.refresh();

    AbstractJasperReportsView view = (AbstractJasperReportsView) ac.getBean("report");
    String encoding = (String) view.getConvertedExporterParameters().get(JRHtmlExporterParameter.CHARACTER_ENCODING);
    assertEquals("UTF-8", encoding);
View Full Code Here

        wac.registerBeanDefinition("viewResolver", new RootBeanDefinition(TestViewResolver.class));
        RootBeanDefinition adapterDef = new RootBeanDefinition(AnnotationMethodHandlerAdapter.class);
        adapterDef.getPropertyValues().addPropertyValue("webBindingInitializer", new MyWebBindingInitializer());
        adapterDef.getPropertyValues().addPropertyValue("customArgumentResolver", new MySpecialArgumentResolver());
        wac.registerBeanDefinition("handlerAdapter", adapterDef);
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());
View Full Code Here

    DispatcherServlet servlet = new DispatcherServlet() {
      protected WebApplicationContext createWebApplicationContext(WebApplicationContext parent) {
        GenericWebApplicationContext wac = new GenericWebApplicationContext();
        wac.registerBeanDefinition("controller", new RootBeanDefinition(MyBinderInitializingCommandProvidingFormController.class));
        wac.registerBeanDefinition("viewResolver", new RootBeanDefinition(TestViewResolver.class));
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());
View Full Code Here

    DispatcherServlet servlet = new DispatcherServlet() {
      protected WebApplicationContext createWebApplicationContext(WebApplicationContext parent) {
        GenericWebApplicationContext wac = new GenericWebApplicationContext();
        wac.registerBeanDefinition("controller", new RootBeanDefinition(MySpecificBinderInitializingCommandProvidingFormController.class));
        wac.registerBeanDefinition("viewResolver", new RootBeanDefinition(TestViewResolver.class));
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());
View Full Code Here

        RootBeanDefinition bd = new RootBeanDefinition(MyParameterDispatchingController.class);
        bd.setScope(WebApplicationContext.SCOPE_REQUEST);
        wac.registerBeanDefinition("controller", bd);
        AnnotationConfigUtils.registerAnnotationConfigProcessors(wac);
        wac.getBeanFactory().registerResolvableDependency(ServletConfig.class, servletConfig);
        wac.refresh();
        return wac;
      }
    };
    servlet.init(servletConfig);
View Full Code Here

    @SuppressWarnings("serial")
    DispatcherServlet servlet = new DispatcherServlet() {
      protected WebApplicationContext createWebApplicationContext(WebApplicationContext parent) {
        GenericWebApplicationContext wac = new GenericWebApplicationContext();
        wac.registerBeanDefinition("controller", new RootBeanDefinition(MethodNameDispatchingController.class));
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());
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.