List of usage examples for org.springframework.web.servlet DispatcherServlet DispatcherServlet
public DispatcherServlet(WebApplicationContext webApplicationContext)
From source file:http2.Main.java
public static void main(String[] args) throws Exception { AnnotationConfigWebApplicationContext cxt = new AnnotationConfigWebApplicationContext(); cxt.register(WebConfig.class); DispatcherServlet dispatcherServlet = new DispatcherServlet(cxt); Server server = new Server(); ServletContextHandler context = new ServletContextHandler(); context.setResourceBase("src/main/webapp"); context.addServlet(new ServletHolder("default", DefaultServlet.class), ""); context.addServlet(new ServletHolder(dispatcherServlet), "/"); context.addFilter(new FilterHolder(new PushCacheFilter()), "/*", EnumSet.of(DispatcherType.REQUEST)); server.setHandler(context);// ww w.j a va 2 s .c om HttpConfiguration httpConfig = new HttpConfiguration(); httpConfig.setSecureScheme("https"); httpConfig.setSecurePort(8443); httpConfig.setSendXPoweredBy(true); httpConfig.setSendServerVersion(true); HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig); httpsConfig.addCustomizer(new SecureRequestCustomizer()); ServerConnector httpConnector = new ServerConnector(server, new HttpConnectionFactory(httpConfig)); httpConnector.setPort(8080); server.addConnector(httpConnector); ServerConnector http2Connector = createHttp2Connector(server, httpsConfig); http2Connector.setPort(8443); server.addConnector(http2Connector); ALPN.debug = true; server.start(); server.dumpStdErr(); server.join(); }
From source file:ip.ip.rest.config.WebAppInitializer.java
public void onStartup(javax.servlet.ServletContext sc) throws javax.servlet.ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(ApplicationConfig.class); ctx.setServletContext(sc);/* w w w. jav a 2s . co m*/ ServletRegistration.Dynamic dynamic = sc.addServlet("dispatcher", new DispatcherServlet(ctx)); dynamic.addMapping("/"); dynamic.setLoadOnStartup(1); }
From source file:com.chuangtc.config.SpringWebInitializer.java
public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(AppConfig.class); ctx.setServletContext(servletContext); Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx)); servlet.addMapping("/"); servlet.setLoadOnStartup(1);/*from w ww . j a v a 2s. c o m*/ }
From source file:com.chevres.config.WebInitializer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(Config.class); ctx.setServletContext(servletContext); Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx)); servlet.addMapping("/"); servlet.setLoadOnStartup(1);//from ww w. ja v a2 s . c o m }
From source file:com.se.configuracion.WebInitializer.java
@Override public void onStartup(ServletContext sc) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(Config.class); ctx.setServletContext(sc);//from www . j av a 2 s . c o m Dynamic servlet = sc.addServlet("dispatcher", new DispatcherServlet(ctx)); servlet.addMapping("/"); servlet.setLoadOnStartup(1); }
From source file:com.sbtn.spring.config.WebInitializer.java
@Override public void onStartup(ServletContext sc) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(Config.class); ctx.setServletContext(sc);/*from w w w . j a v a2s . com*/ Dynamic servlet = sc.addServlet("dispatcher", new DispatcherServlet(ctx)); servlet.addMapping("/"); servlet.setLoadOnStartup(1); }
From source file:com.shadows.liquiblq.webapi.config.WebAppInitializer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(AppConfig.class); ctx.setServletContext(servletContext); Dynamic dynamic = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx)); dynamic.addMapping("/"); dynamic.setLoadOnStartup(1);/*from w w w . ja v a 2s . c om*/ }
From source file:com.triage.springweb.WebInitializer.java
public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(Config.class); ctx.setServletContext(servletContext); Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx)); servlet.addMapping("/"); servlet.setLoadOnStartup(1);/*from w w w. j a v a2 s . c o m*/ }
From source file:com.mycompany.config.WebInitializer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(Config.class); ctx.setServletContext(servletContext); ServletRegistration.Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx)); servlet.addMapping("/"); servlet.setLoadOnStartup(1);//from ww w .j a v a 2s . c o m }
From source file:com.mycompany.comerciobici.controlador.InicializadorRest.java
public void onStartup(ServletContext servletContext) throws ServletException { AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); ctx.register(CargadorApplicacion.class); ctx.setServletContext(servletContext); ServletRegistration.Dynamic dynamic = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx)); dynamic.addMapping("/"); dynamic.setLoadOnStartup(1);//from w ww .ja va 2 s . c o m }