Examples of DispatcherServlet


Examples of org.springframework.web.servlet.DispatcherServlet

    final AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext();
    root.setServletContext(ctx);
    root.scan("app");
    root.refresh();

    final Dynamic servlet = ctx.addServlet("spring", new DispatcherServlet(root));
    servlet.setLoadOnStartup(1);
    servlet.addMapping("/");
  }
View Full Code Here

Examples of org.springframework.web.servlet.DispatcherServlet

    @Override
    public void onStartup(ServletContext servletContext) throws ServletException {
        AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
        rootContext.register(ApplicationContext.class);

        ServletRegistration.Dynamic dispatcher = servletContext.addServlet(DISPATCHER_SERVLET_NAME, new DispatcherServlet(rootContext));
        dispatcher.setLoadOnStartup(1);
        dispatcher.addMapping(DISPATCHER_SERVLET_MAPPING_HOME);
        dispatcher.addMapping(DISPATCHER_SERVLET_MAPPING_PRODUCTS);
        dispatcher.addMapping(DISPATCHER_SERVLET_MAPPING_SERVICES);
View Full Code Here

Examples of org.springframework.web.servlet.DispatcherServlet

    //Context loader listener
    servletContext.addListener(new ContextLoaderListener(rootContext));
   
    //Dispatcher servlet
    ServletRegistration.Dynamic dispatcher =
        servletContext.addServlet("dispatcher", new DispatcherServlet(rootContext));
    dispatcher.setLoadOnStartup(1);
    dispatcher.addMapping("/");
  }
View Full Code Here

Examples of org.springframework.web.servlet.DispatcherServlet

        //2、springmvc上下文
        AnnotationConfigWebApplicationContext springMvcContext = new AnnotationConfigWebApplicationContext();
        springMvcContext.register(MvcConfiguration.class);
        //3、DispatcherServlet
        DispatcherServlet dispatcherServlet = new DispatcherServlet(springMvcContext);
        ServletRegistration.Dynamic dynamic = sc.addServlet("dispatcherServlet", dispatcherServlet);
        dynamic.setLoadOnStartup(1);
        dynamic.addMapping("/");

        //4、CharacterEncodingFilter
View Full Code Here

Examples of org.springframework.web.servlet.DispatcherServlet

                    xmlReader.loadBeanDefinitions(new ClassPathResource(springMvcApplicationContextLocation,
                            module.getClassLoader()));
                    mvcContext.setParent(existingLilyRuntimeSpringContext);
                    mvcContext.refresh();

                    DispatcherServlet dispatcherServlet = new DispatcherServlet(mvcContext);
                    dispatcherServlet.setDetectAllHandlerMappings(true);
                    return dispatcherServlet;
                } finally {
                    Thread.currentThread().setContextClassLoader(orig);
                }
            }
View Full Code Here

Examples of org.springframework.web.servlet.DispatcherServlet

  
   @Test
   public void testGetHandlerMappings() throws Exception
   {
      DispatcherServlet dispatcher = new DispatcherServlet();
     
      DispatcherServletAnalyzer analyzer = new DispatcherServletAnalyzer(dispatcher);
      System.out.println("handler mappings: " +  analyzer.getHandlerMappings());
     
   }
View Full Code Here

Examples of org.springframework.web.servlet.DispatcherServlet

    }

    private void addServiceDispatcherServlet(ServletContext container, AnnotationConfigWebApplicationContext rootContext) {
        final String SERVICES_MAPPING = "/";

        ServletRegistration.Dynamic dispatcher = container.addServlet("servicesDispatcher", new DispatcherServlet(rootContext));
        dispatcher.setLoadOnStartup(1);
        Set<String> mappingConflicts = dispatcher.addMapping(SERVICES_MAPPING);

        if (!mappingConflicts.isEmpty()) {
            for (String s : mappingConflicts) {
View Full Code Here

Examples of org.springframework.web.servlet.DispatcherServlet

        // Create the dispatcher servlet's Spring application context
        AnnotationConfigWebApplicationContext dispatcherContext = new AnnotationConfigWebApplicationContext();
        dispatcherContext.register(WebConfig.class);

        // Register and map the dispatcher servlet
        ServletRegistration.Dynamic dispatcher = container.addServlet("dispatcher", new DispatcherServlet(
                dispatcherContext));
        dispatcher.setLoadOnStartup(1);
        dispatcher.addMapping("/");
    }
View Full Code Here

Examples of org.springframework.web.servlet.DispatcherServlet

    dispatcherContext.register(WebConfiguration.class);

    servletContext.addListener(new ContextLoaderListener(dispatcherContext));


    ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher", new DispatcherServlet(dispatcherContext));
    dispatcher.setLoadOnStartup(1);
    dispatcher.setAsyncSupported(true);
    dispatcher.addMapping("/");
  }
View Full Code Here

Examples of org.springframework.web.servlet.DispatcherServlet

  @Override
  public void onStartup(ServletContext container) {
    XmlWebApplicationContext appContext = new XmlWebApplicationContext();
    appContext.setConfigLocation("/WEB-INF/applicationContext.xml");

    ServletRegistration.Dynamic dispatcher = container.addServlet("dispatcher", new DispatcherServlet(appContext));
    dispatcher.setLoadOnStartup(1);
    dispatcher.addMapping("/");
  }
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.