Package org.springframework.web.servlet

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


    //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

        //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

                    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

  
   @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

    }

    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

        // 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

    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

  @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

  @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

Related Classes of org.springframework.web.servlet.DispatcherServlet

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.