List of usage examples for org.springframework.web.context ContextLoaderListener ContextLoaderListener
public ContextLoaderListener(WebApplicationContext context)
From source file:com.bentechapps.angularcrud.config.SpringApplicationInitializer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { //Tell jersey-spring3 the context is already initialized servletContext.setInitParameter("contextConfigLocation", "NOTNULL"); AnnotationConfigWebApplicationContext appContext = new AnnotationConfigWebApplicationContext(); appContext.register(SpringApplication.class); servletContext.addListener(new ContextLoaderListener(appContext)); }
From source file:gr.pskoufos.initializer.AppInitializer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(AppConfig.class); ctx.setServletContext(servletContext); servletContext.addListener(new ContextLoaderListener(ctx)); servletContext.addListener(new RequestContextListener()); Dynamic dynamic = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx)); dynamic.addMapping("/"); dynamic.setLoadOnStartup(1);//www .j a v a2 s . c o m }
From source file:com.sishuok.chapter2.initializer.NoXmlWebAppInitializer.java
@Override public void onStartup(final ServletContext sc) throws ServletException { //1?/*from ww w . j a v a 2 s. c o m*/ 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.emmanuel.spring.chat.config.webxml.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);//from ww w .j ava 2s .com dispatcher.addMapping(MAPPING_URL); }
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 va 2 s .co m dispatcher.addMapping("/"); }
From source file:com.jjcosare.calculator.config.WebInitializer.java
@Override public void onStartup(ServletContext container) throws ServletException { // Create the 'root' Spring application context AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.register(WebConfig.class); // Manage the lifecycle of the root application context container.addListener(new ContextLoaderListener(rootContext)); // Create the dispatcher servlet's Spring application context AnnotationConfigWebApplicationContext dispatcherContext = new AnnotationConfigWebApplicationContext(); dispatcherContext.register(DispatcherConfig.class); // Register and map the dispatcher servlet ServletRegistration.Dynamic dispatcher = container.addServlet("dispatcher", new DispatcherServlet(dispatcherContext)); dispatcher.setLoadOnStartup(1);// ww w . j av a 2 s . com dispatcher.addMapping("/"); }
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 w w. j a va 2 s .co m 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: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 va 2 s . c o m dispatcher.addMapping("/"); }
From source file:com.tamnd.app.init.WebMvcInitializer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { // Create the 'root' Spring application context WebApplicationContext context = context(); // Manage the lifecycle of the root application context servletContext.addListener(new ContextLoaderListener(context)); DispatcherServlet dispatcherServlet = new DispatcherServlet(context); dispatcherServlet.setThrowExceptionIfNoHandlerFound(true); ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcherServlet", dispatcherServlet); dispatcher.setLoadOnStartup(1);// w w w .ja v a 2 s . co m dispatcher.addMapping(MAPPING_URL); servletContext .addFilter("securityFilter", new DelegatingFilterProxy("springSecurityFilterChain"/*Do not change this name*/)) .addMappingForUrlPatterns(null, false, "/*"); // servletContext.addFilter("hibernateFilter", new OpenSessionInViewFilter()) // .addMappingForUrlPatterns(null, false, "/*"); }
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);//from www.j ava 2 s . com dispatcher.addMapping(MAPPING_URL); ServletRegistration.Dynamic ws = servletContext.addServlet("MessageDispatcherServlet", new MessageDispatcherServlet(context)); ws.setInitParameter("transformWsdlLocations", "true"); ws.addMapping("/services/*"); }