List of usage examples for org.springframework.web.servlet DispatcherServlet DispatcherServlet
public DispatcherServlet(WebApplicationContext webApplicationContext)
From source file:org.utb.project.ServletInitializer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { WebApplicationContext webApplicationContext = getWebContext(); servletContext.setSessionTrackingModes(new HashSet<SessionTrackingMode>() { {//from w ww.j ava 2 s . c om add(SessionTrackingMode.COOKIE); } }); servletContext.addListener(new ContextLoaderListener(webApplicationContext)); ServletRegistration.Dynamic dispatcher = servletContext.addServlet("ProyectoSoftware", new DispatcherServlet(webApplicationContext)); dispatcher.setAsyncSupported(true); dispatcher.setLoadOnStartup(0); dispatcher.addMapping("/*"); }
From source file:com.pojur.config.AppInitializer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { // WebApplicationContext context = getContext(); AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.register(ServiceConfig.class, JPAConfig.class); servletContext.addListener(new ContextLoaderListener(rootContext)); AnnotationConfigWebApplicationContext dispatcherServlet = new AnnotationConfigWebApplicationContext(); dispatcherServlet.register(WebMvcConfig.class); ServletRegistration.Dynamic dispatcher = servletContext.addServlet("DispatcherServlet", new DispatcherServlet(dispatcherServlet)); dispatcher.setLoadOnStartup(1);/*from w w w. j a v a2 s. c om*/ dispatcher.addMapping("/"); }
From source file:olsps.com.healthsoftproject.config.SpringWebAppInitializer.java
@Override public void onStartup(ServletContext container) throws ServletException { AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.register(ApplicationConfigClass.class); // Manage the lifecycle of the root application context container.addListener(new ContextLoaderListener(rootContext)); ServletRegistration.Dynamic dispatcher = container.addServlet("dispatcher", new DispatcherServlet(rootContext)); dispatcher.setLoadOnStartup(1);/* w w w .ja v a 2 s. c om*/ dispatcher.addMapping("/"); }
From source file:org.consultjr.mvc.core.config.ApplicationInitializer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { WebApplicationContext context = getContext(); servletContext.addListener(new ContextLoaderListener(context)); servletContext.addListener(new ApplicationSessionListener()); ServletRegistration.Dynamic dispatcher = servletContext.addServlet("DispatcherServlet", new DispatcherServlet(context)); dispatcher.setLoadOnStartup(1);/*from w w w .j a v a 2 s . c o m*/ dispatcher.addMapping("/"); }
From source file:nl.avans.ivh5a1.proftaak.config.ApplicationConfig.java
@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);//from ww w .j a v a2s. co m dispatcher.addMapping(DISPATCHER_SERVLET_MAPPING); // FilterRegistration.Dynamic sitemesh = servletContext.addFilter("sitemesh", new ConfigurableSiteMeshFilter()); // EnumSet<DispatcherType> sitemeshDispatcherTypes = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD); // sitemesh.addMappingForUrlPatterns(sitemeshDispatcherTypes, true, "*.jsp"); servletContext.addListener(new ContextLoaderListener(rootContext)); }
From source file:org.efoe.poc.springws.provider.xmlbeans.initializer.WebXml.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { WebApplicationContext context = getContext(); servletContext.addListener(new ContextLoaderListener(context)); ServletRegistration.Dynamic dispatcher = servletContext.addServlet("DispatcherServlet", new DispatcherServlet(context)); dispatcher.setLoadOnStartup(1);// w w w . j av a 2 s. c o m dispatcher.addMapping(MAPPING_URL); ServletRegistration.Dynamic ws = servletContext.addServlet("MessageDispatcherServlet", new MessageDispatcherServlet(context)); ws.setInitParameter("transformWsdlLocations", "true"); ws.addMapping("/services/*"); }
From source file:ca.n4dev.dev.worktime.config.SpringAppInitializer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { WebApplicationContext context = getContext(); servletContext.addListener(new ContextLoaderListener(context)); ServletRegistration.Dynamic dispatcher = servletContext.addServlet("DispatcherServlet", new DispatcherServlet(context)); //servletContext.addFilter("springSecurityFilterChain", new DelegatingFilterProxy("springSecurityFilterChain")).addMappingForUrlPatterns(null, false, "/*"); dispatcher.setLoadOnStartup(1);// w w w. java 2 s .c o m dispatcher.addMapping(MAPPING_URL); }
From source file:com.sishuok.chapter2.initializer.NoXmlWebAppInitializer.java
@Override public void onStartup(final ServletContext sc) throws ServletException { //1?//w ww .j av a 2 s . com AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.register(RootConfiguration.class); sc.addListener(new ContextLoaderListener(rootContext)); //2?springmvc AnnotationConfigWebApplicationContext springMvcContext = new AnnotationConfigWebApplicationContext(); springMvcContext.register(SpringMvcConfiguration.class); //3?DispatcherServlet DispatcherServlet dispatcherServlet = new DispatcherServlet(springMvcContext); ServletRegistration.Dynamic dynamic = sc.addServlet("dispatcherServlet", dispatcherServlet); dynamic.setLoadOnStartup(1); dynamic.addMapping("/"); }
From source file:org.cloudfoundry.caldecott.server.config.SpringWebApplicationInitializer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext springContext = new AnnotationConfigWebApplicationContext(); springContext.register(WebApplicationConfiguration.class); DispatcherServlet servlet = new DispatcherServlet(springContext); ServletRegistration.Dynamic registration = servletContext.addServlet("dispatcher", servlet); registration.setLoadOnStartup(1);//www.j a v a2 s. c o m registration.addMapping("/*"); }
From source file:com.biendltb.main_server.TripMapServer.java
private static ServletContextHandler getServletContextHandler(WebApplicationContext context) throws IOException { ServletContextHandler contextHandler = new ServletContextHandler(); contextHandler.setErrorHandler(null); contextHandler.setContextPath(CONTEXT_PATH); contextHandler.addServlet(new ServletHolder("default", new DispatcherServlet(context)), MAPPING_URL); contextHandler.addEventListener(new ContextLoaderListener(context)); contextHandler.setResourceBase(new ClassPathResource("webapp").getURI().toString()); return contextHandler; }