List of usage examples for org.springframework.web.context ContextLoaderListener ContextLoaderListener
public ContextLoaderListener(WebApplicationContext context)
From source file:org.akhikhl.examples.gretty.hellogretty.AppInitializer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { WebApplicationContext context = getContext(); servletContext.addListener(new ContextLoaderListener(context)); }
From source file:com.dm.platform.spring.MyWebApplicationInitializer.java
public void onStartup(ServletContext container) { System.out.println("MyWebApplicationInitializer[onStartup]"); XmlWebApplicationContext ac = new XmlWebApplicationContext(); container.addListener(new ContextLoaderListener(ac)); // ServletRegistration.Dynamic registration = container.addServlet("dispatcher", new DispatcherServlet()); // registration.setLoadOnStartup(1); // registration.addMapping("/spring/*"); }
From source file:com.bitran.config.Inicializador.java
@Override public void onStartup(ServletContext sc) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.scan("com.bitran"); sc.addListener(new ContextLoaderListener(ctx)); Dynamic servlet = sc.addServlet("appServlet", new DispatcherServlet(ctx)); servlet.setAsyncSupported(true);// w ww . java 2 s . c o m servlet.setLoadOnStartup(1); servlet.addMapping("*.action"); }
From source file:sg.edu.ntu.hrms.web.action.WebInit.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext appContext = new AnnotationConfigWebApplicationContext(); appContext.register(AppConfig.class); ContextLoaderListener contextLoaderListener = new ContextLoaderListener(appContext); servletContext.addListener(contextLoaderListener); /*// w w w. ja v a 2 s.c o m FilterRegistration.Dynamic filter = servletContext.addFilter( "StrutsDispatcher", new StrutsPrepareAndExecuteFilter()); filter.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, "/*"); */ }
From source file:com.library.bookarticlelibrary.WebAppInitializer.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 w ww . j a va 2 s .c o m dispatcher.addMapping("/"); dispatcher.addMapping("*.css"); dispatcher.addMapping("*.js"); dispatcher.addMapping("*.pdf"); dispatcher.addMapping("*.json"); }
From source file:com.opencart.config.Initializer.java
@Override public void onStartup(ServletContext sc) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(SpringConfigurations.class); sc.addListener(new ContextLoaderListener(ctx)); ctx.setServletContext(sc);/* w ww .j ava2 s . c o m*/ Dynamic servlet = sc.addServlet("dispatcher", new DispatcherServlet(ctx)); servlet.addMapping("/"); servlet.setLoadOnStartup(1); }
From source file:com.swordcode.webcore.security.testui.TestAppInitializer.java
@Override public void onStartup(ServletContext container) throws ServletException { // Use Spring AnnotationConfigWebApplicationContext to avoid using any xml files. AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.register(TestAppConfig.class); container.addListener(new ContextLoaderListener(rootContext)); ServletRegistration.Dynamic vaadinRoot = container.addServlet("vaadin", new SecurityTestUI.Servlet()); vaadinRoot.setLoadOnStartup(1);//from www .j a v a 2 s.c om vaadinRoot.setAsyncSupported(true); vaadinRoot.addMapping("/*"); // FilterRegistration.Dynamic jpaFilter = container.addFilter("springJPA", OpenEntityManagerInViewFilter.class); // jpaFilte // Filter f = new OpenEntityManagerInViewFilter(); // ServletRegistration.Dynamic filter = container.addFilter("/*", f);//org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.class); }
From source file:echec.spring.SpringConfigWebApplicationInitializer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { // Initialise spring au dmarrage de l'application web. AnnotationConfigWebApplicationContext appContext = new AnnotationConfigWebApplicationContext(); appContext.register(SpringConfig.class); servletContext.addListener(new ContextLoaderListener(appContext)); // Register and map the dispatcher servlet ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher", new DispatcherServlet(appContext)); dispatcher.setLoadOnStartup(1);/* www .ja v a 2s . co m*/ 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);/* w w w. j av a 2 s . co m*/ dispatcher.addMapping("/"); }
From source file:com.mycompany.spring2explore.config.WebAppInitializer.java
@Override public void onStartup(ServletContext cs) { // Create the 'root' Spring application context AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.register(SpringRootConfig.class); // Manage the lifecycle of the root application context cs.addListener(new ContextLoaderListener(rootContext)); // Create the dispatcher servlet's Spring application context AnnotationConfigWebApplicationContext dispatcherServlet = new AnnotationConfigWebApplicationContext(); dispatcherServlet.register(MvcConfig.class); // Register and map the dispatcher servlet ServletRegistration.Dynamic dispatcher = cs.addServlet("dispatcher", new DispatcherServlet(dispatcherServlet)); dispatcher.setLoadOnStartup(1);/* w w w .j av a 2 s .c o m*/ dispatcher.addMapping("/"); }