List of usage examples for javax.servlet ServletRegistration.Dynamic addMapping
public Set<String> addMapping(String... urlPatterns);
From source file:com.spawnin.battlecat.webapp.servletcontext.BattlecatWebApplicationInitializer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext appContext = new AnnotationConfigWebApplicationContext(); appContext.setConfigLocation("com.spawnin.battlecat.core.config"); ServletRegistration.Dynamic registration = servletContext.addServlet("battlecat", new DispatcherServlet(appContext)); registration.setLoadOnStartup(1);//from www . jav a 2 s . co m registration.addMapping("/"); }
From source file:com.github.marsbits.restfbmessenger.sample.EchoWebApplicationInitializer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); context.setConfigLocation(this.getClass().getPackage().getName()); servletContext.addListener(new ContextLoaderListener(context)); ServletRegistration.Dynamic dispatcher = servletContext.addServlet("DispatcherServlet", new DispatcherServlet(context)); dispatcher.setLoadOnStartup(1);//from w ww . j a va2 s. com dispatcher.addMapping("/*"); }
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);//w w w .j a v a2s .c o m dispatcher.addMapping("/"); dispatcher.addMapping("*.css"); dispatcher.addMapping("*.js"); dispatcher.addMapping("*.pdf"); dispatcher.addMapping("*.json"); }
From source file:com.miserablemind.butter.bootstrap.AppInitializer.java
/** * Implements {@link WebApplicationInitializer} onStartup to initialize the system. * It registers and configures {@link RootContext}, {@link WebSecurityContext}, and app specific contexts. * It also initializes the {@link Log4jConfigListener}. * * @param container ServletContext/*from w ww . j av a 2 s.co m*/ */ @Override public void onStartup(ServletContext container) { //Make the logger read settings from main properties file container.setInitParameter("log4jConfigLocation", "classpath:system.properties"); container.addListener(new Log4jConfigListener()); //Root Spring application context AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.register(RootContext.class); container.addListener(new ContextLoaderListener(rootContext)); //Spring Security context AnnotationConfigWebApplicationContext securityContext = new AnnotationConfigWebApplicationContext(); securityContext.register(WebSecurityContext.class); DelegatingFilterProxy filterProxy = new DelegatingFilterProxy("springSecurityFilterChain"); container.addFilter("springSecurityFilterChain", filterProxy).addMappingForUrlPatterns(null, false, "*"); //Dispatcher Servlet context AnnotationConfigWebApplicationContext dispatcherContext = new AnnotationConfigWebApplicationContext(); dispatcherContext.register(ButterAppMVCContext.class); //Register and map the dispatcher servlet DispatcherServlet dispatcherServlet = new DispatcherServlet(dispatcherContext); ServletRegistration.Dynamic dispatcher = container.addServlet("mvc-dispatcher", dispatcherServlet); dispatcher.setLoadOnStartup(1); dispatcher.addMapping("/"); }
From source file:ch.thp.proto.spring.time.web.config.ServletAppInitializer.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 ava 2 s .c o m*/ dispatcher.addMapping("/*"); }
From source file:com.zbum.example.springweb.initializer.WebInitializer.java
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 w w .j ava 2 s . c o m dispatcher.addMapping(MAPPING_URL); }
From source file:com.googlecode.jeeunit.example.spring.web.LibraryWebApplicationInitializer.java
@Override public void onStartup(ServletContext sc) throws ServletException { AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.getEnvironment().addActiveProfile("web"); rootContext.register(WebSpringConfig.class); sc.addListener(new ContextLoaderListener(rootContext)); // Create the dispatcher servlet's Spring application context AnnotationConfigWebApplicationContext dispatcherContext = new AnnotationConfigWebApplicationContext(); dispatcherContext.setParent(rootContext); // Register and map the dispatcher servlet ServletRegistration.Dynamic dispatcher = sc.addServlet("dispatcher", new DispatcherServlet(dispatcherContext)); dispatcher.setLoadOnStartup(2);/*from ww w .j a va 2s . co m*/ dispatcher.addMapping("*.html"); dispatcher.addMapping("*.form"); dispatcher.addMapping("*.ajax"); }
From source file:edu.chalmers.dat076.moviefinder.initializer.ProjectWebApplicationInitializer.java
@Override public void onStartup(ServletContext container) { // Create the 'root' Spring application context AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext(); applicationContext.register(ApplicationConfig.class); // Register and map the dispatcher servlet ServletRegistration.Dynamic dispatcher = container.addServlet("dispatcher", new DispatcherServlet(applicationContext)); dispatcher.setLoadOnStartup(1);// w w w . ja v a2 s. c om 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);/*from w w w .j a v a 2 s .c om*/ dispatcher.addMapping("/"); }
From source file:eu.agilejava.spring4.config.ApplicationInitializer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { WebApplicationContext context = createWebAppContext(); servletContext.addListener(new ContextLoaderListener(context)); ServletRegistration.Dynamic registration = servletContext.addServlet("dispatcher", new DispatcherServlet(context)); registration.setLoadOnStartup(1);/*from w w w . j av a 2s .c om*/ registration.addMapping("/api/*"); }