Package org.springframework.web.context.support

Examples of org.springframework.web.context.support.GenericWebApplicationContext


  public void testMethodNameDispatchingControllerWithSuffix() throws Exception {
    @SuppressWarnings("serial")
    DispatcherServlet servlet = new DispatcherServlet() {
      protected WebApplicationContext createWebApplicationContext(WebApplicationContext parent) {
        GenericWebApplicationContext wac = new GenericWebApplicationContext();
        wac.registerBeanDefinition("controller", new RootBeanDefinition(MethodNameDispatchingController.class));
        InternalPathMethodNameResolver methodNameResolver = new InternalPathMethodNameResolver();
        methodNameResolver.setSuffix("Handle");
        RootBeanDefinition adapterDef = new RootBeanDefinition(AnnotationMethodHandlerAdapter.class);
        adapterDef.getPropertyValues().addPropertyValue("methodNameResolver", methodNameResolver);
        wac.registerBeanDefinition("handlerAdapter", adapterDef);
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());
View Full Code Here


  public void testControllerClassNamePlusMethodNameDispatchingController() throws Exception {
    @SuppressWarnings("serial")
    DispatcherServlet servlet = new DispatcherServlet() {
      protected WebApplicationContext createWebApplicationContext(WebApplicationContext parent) {
        GenericWebApplicationContext wac = new GenericWebApplicationContext();
        RootBeanDefinition mapping = new RootBeanDefinition(ControllerClassNameHandlerMapping.class);
        mapping.getPropertyValues().addPropertyValue("excludedPackages", null);
        wac.registerBeanDefinition("handlerMapping", mapping);
        wac.registerBeanDefinition("controller", new RootBeanDefinition(MethodNameDispatchingController.class));
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());
View Full Code Here

  public void testPostMethodNameDispatchingController() throws Exception {
    @SuppressWarnings("serial")
    DispatcherServlet servlet = new DispatcherServlet() {
      protected WebApplicationContext createWebApplicationContext(WebApplicationContext parent) {
        GenericWebApplicationContext wac = new GenericWebApplicationContext();
        wac.registerBeanDefinition("controller", new RootBeanDefinition(MyPostMethodNameDispatchingController.class));
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());
View Full Code Here

  public void testRelativePathDispatchingController() throws Exception {
    @SuppressWarnings("serial")
    DispatcherServlet servlet = new DispatcherServlet() {
      protected WebApplicationContext createWebApplicationContext(WebApplicationContext parent) {
        GenericWebApplicationContext wac = new GenericWebApplicationContext();
        wac.registerBeanDefinition("controller", new RootBeanDefinition(MyRelativePathDispatchingController.class));
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());
View Full Code Here

  public void testNullCommandController() throws Exception {
    @SuppressWarnings("serial")
    DispatcherServlet servlet = new DispatcherServlet() {
      protected WebApplicationContext createWebApplicationContext(WebApplicationContext parent) {
        GenericWebApplicationContext wac = new GenericWebApplicationContext();
        wac.registerBeanDefinition("controller", new RootBeanDefinition(MyNullCommandController.class));
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());
View Full Code Here

  public void testEquivalentMappingsWithSameMethodName() throws Exception {
    @SuppressWarnings("serial")
    DispatcherServlet servlet = new DispatcherServlet() {
      protected WebApplicationContext createWebApplicationContext(WebApplicationContext parent) {
        GenericWebApplicationContext wac = new GenericWebApplicationContext();
        wac.registerBeanDefinition("controller", new RootBeanDefinition(ChildController.class));
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());
View Full Code Here

  public void testStandardHandleMethod() throws Exception {
    @SuppressWarnings("serial")
    DispatcherServlet servlet = new DispatcherServlet() {
      protected WebApplicationContext createWebApplicationContext(WebApplicationContext parent) {
        GenericWebApplicationContext wac = new GenericWebApplicationContext();
        wac.registerBeanDefinition("controller", new RootBeanDefinition(MyController.class));
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());
View Full Code Here

  }

  public void testProxiedStandardHandleMethod() throws Exception {
    DispatcherServlet servlet = new DispatcherServlet() {
      protected WebApplicationContext createWebApplicationContext(WebApplicationContext parent) {
        GenericWebApplicationContext wac = new GenericWebApplicationContext();
        wac.registerBeanDefinition("controller", new RootBeanDefinition(MyController.class));
        DefaultAdvisorAutoProxyCreator autoProxyCreator = new DefaultAdvisorAutoProxyCreator();
        autoProxyCreator.setBeanFactory(wac.getBeanFactory());
        wac.getBeanFactory().addBeanPostProcessor(autoProxyCreator);
        wac.getBeanFactory().registerSingleton("advisor", new DefaultPointcutAdvisor(new SimpleTraceInterceptor()));
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());
View Full Code Here

  public void testEmptyParameterListHandleMethod() throws Exception {
    @SuppressWarnings("serial")
    DispatcherServlet servlet = new DispatcherServlet() {
      protected WebApplicationContext createWebApplicationContext(WebApplicationContext parent) {
        GenericWebApplicationContext wac = new GenericWebApplicationContext();
        wac.registerBeanDefinition("controller", new RootBeanDefinition(EmptyParameterListHandlerMethodController.class));
        RootBeanDefinition vrDef = new RootBeanDefinition(InternalResourceViewResolver.class);
        vrDef.getPropertyValues().addPropertyValue("suffix", ".jsp");
        wac.registerBeanDefinition("viewResolver", vrDef);
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());
View Full Code Here

  private void doTestAdaptedHandleMethods(final Class<?> controllerClass) throws Exception {
    @SuppressWarnings("serial")
    DispatcherServlet servlet = new DispatcherServlet() {
      protected WebApplicationContext createWebApplicationContext(WebApplicationContext parent) {
        GenericWebApplicationContext wac = new GenericWebApplicationContext();
        wac.registerBeanDefinition("controller", new RootBeanDefinition(controllerClass));
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());
View Full Code Here

TOP

Related Classes of org.springframework.web.context.support.GenericWebApplicationContext

Copyright © 2018 www.massapicom. 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.