下面列出了javax.servlet.ServletRegistration.Dynamic#setLoadOnStartup ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
rootContext.setServletContext(servletContext);
rootContext.register(ThymeleafConfig.class);
servletContext.addListener(new SakaiContextLoaderListener(rootContext));
servletContext.addFilter("sakai.request", RequestFilter.class)
.addMappingForUrlPatterns(
EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.INCLUDE),
true,
"/*");
Dynamic servlet = servletContext.addServlet("sakai.googledrive", new DispatcherServlet(rootContext));
servlet.addMapping("/");
servlet.setLoadOnStartup(1);
}
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
rootContext.setServletContext(servletContext);
rootContext.register(ThymeleafConfig.class);
servletContext.addListener(new ToolListener());
servletContext.addListener(new SakaiContextLoaderListener(rootContext));
servletContext.addFilter("sakai.request", RequestFilter.class)
.addMappingForUrlPatterns(
EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.INCLUDE),
true,
"/*");
Dynamic servlet = servletContext.addServlet("sakai.message.bundle.manager", new DispatcherServlet(rootContext));
servlet.addMapping("/");
servlet.setLoadOnStartup(1);
}
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
rootContext.setServletContext(servletContext);
rootContext.register(ThymeleafConfig.class);
servletContext.addListener(new ToolListener());
servletContext.addListener(new SakaiContextLoaderListener(rootContext));
FilterRegistration requestFilterRegistration = servletContext.addFilter("sakai.request", RequestFilter.class);
requestFilterRegistration.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.INCLUDE), true, "/*");
requestFilterRegistration.setInitParameter(RequestFilter.CONFIG_UPLOAD_ENABLED, "true");
Dynamic servlet = servletContext.addServlet("sakai-site-group-manager", new DispatcherServlet(rootContext));
servlet.addMapping("/");
servlet.setLoadOnStartup(1);
}
private static void registerCXFServlet(ServletContext servletContext) {
LOGGER.info("Registering CXF servlet...");
Dynamic dynamic =
servletContext.
addServlet(
"LDP4jFrontendServerServlet",
"org.apache.cxf.transport.servlet.CXFServlet");
dynamic.addMapping("/*");
/** See https://issues.apache.org/jira/browse/CXF-5068 */
dynamic.setInitParameter("disable-address-updates","true");
/** Required for testing */
dynamic.setInitParameter("static-welcome-file","/index.html");
dynamic.setInitParameter("static-resources-list","/index.html");
dynamic.setLoadOnStartup(1);
LOGGER.info("CXF servlet registered.");
}
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
rootContext.setServletContext(servletContext);
rootContext.register(ThymeleafConfig.class);
servletContext.addListener(new ToolListener());
servletContext.addListener(new SakaiContextLoaderListener(rootContext));
FilterRegistration requestFilterRegistration = servletContext.addFilter("sakai.request", RequestFilter.class);
requestFilterRegistration.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.INCLUDE), true, "/*");
requestFilterRegistration.setInitParameter(RequestFilter.CONFIG_UPLOAD_ENABLED, "true");
Dynamic servlet = servletContext.addServlet("sakai-site-group-manager", new DispatcherServlet(rootContext));
servlet.addMapping("/");
servlet.setLoadOnStartup(1);
}
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
rootContext.setServletContext(servletContext);
rootContext.register(ThymeleafConfig.class);
servletContext.addListener(new ToolListener());
servletContext.addListener(new SakaiContextLoaderListener(rootContext));
servletContext.addFilter("sakai.request", RequestFilter.class)
.addMappingForUrlPatterns(
EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.INCLUDE),
true,
"/*");
Dynamic servlet = servletContext.addServlet("sakai.message.bundle.manager", new DispatcherServlet(rootContext));
servlet.addMapping("/");
servlet.setLoadOnStartup(1);
}
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
rootContext.setServletContext(servletContext);
rootContext.register(ThymeleafConfig.class);
servletContext.addListener(new SakaiContextLoaderListener(rootContext));
servletContext.addFilter("sakai.request", RequestFilter.class)
.addMappingForUrlPatterns(
EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.INCLUDE),
true,
"/*");
Dynamic servlet = servletContext.addServlet("sakai.onedrive", new DispatcherServlet(rootContext));
servlet.addMapping("/");
servlet.setLoadOnStartup(1);
}
@Override
public void onStartup(ServletContext servletContext)
throws ServletException {
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
ctx.register(MyMvcConfig.class);
ctx.setServletContext(servletContext); // ②
Dynamic servlet = servletContext.addServlet("dispatcher",new DispatcherServlet(ctx)); // ③
servlet.addMapping("/");
servlet.setLoadOnStartup(1);
}
@Override
public void onStartup(ServletContext servletContext)
throws ServletException {
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
ctx.register(MyMvcConfig.class);
ctx.setServletContext(servletContext); // ②
Dynamic servlet = servletContext.addServlet("dispatcher",new DispatcherServlet(ctx)); // 3
servlet.addMapping("/");
servlet.setLoadOnStartup(1);
}
@Override
public void onStartup(ServletContext servletContext)
throws ServletException {
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
ctx.register(MyMvcConfig.class);
ctx.setServletContext(servletContext); // ②
Dynamic servlet = servletContext.addServlet("dispatcher",new DispatcherServlet(ctx)); // 3
servlet.addMapping("/");
servlet.setLoadOnStartup(1);
}
@Override
public void onStartup(ServletContext servletContext)
throws ServletException {
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
ctx.register(MyMvcConfig.class);
ctx.setServletContext(servletContext); // ②
Dynamic servlet = servletContext.addServlet("dispatcher",new DispatcherServlet(ctx)); // 3
servlet.addMapping("/");
servlet.setLoadOnStartup(1);
}
@Override
public void onStartup(ServletContext servletContext)
throws ServletException {
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
ctx.register(MyMvcConfig.class);
ctx.setServletContext(servletContext); // ②
Dynamic servlet = servletContext.addServlet("dispatcher",new DispatcherServlet(ctx)); // 3
servlet.addMapping("/");
servlet.setLoadOnStartup(1);
servlet.setAsyncSupported(true);//①
}
@Override
public void onStartup(ServletContext servletContext)
throws ServletException {
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
ctx.register(MyMvcConfig.class);
ctx.setServletContext(servletContext); // ②
Dynamic servlet = servletContext.addServlet("dispatcher",new DispatcherServlet(ctx)); // 3
servlet.addMapping("/");
servlet.setLoadOnStartup(1);
}
@Override
public void onStartup(ServletContext servletContext)
throws ServletException {
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
ctx.register(MyMvcConfig.class);
ctx.setServletContext(servletContext); // ②
Dynamic servlet = servletContext.addServlet("dispatcher",new DispatcherServlet(ctx)); // 3
servlet.addMapping("/");
servlet.setLoadOnStartup(1);
}
@Override
public void onStartup(ServletContext servletContext)
throws ServletException {
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
ctx.register(MyMvcConfig.class);
ctx.setServletContext(servletContext); // ②
Dynamic servlet = servletContext.addServlet("dispatcher",new DispatcherServlet(ctx)); // 3
servlet.addMapping("/");
servlet.setLoadOnStartup(1);
}
@Override
public void onStartup(ServletContext servletContext)
throws ServletException {
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
ctx.register(MyMvcConfig.class);
ctx.setServletContext(servletContext); // ②
Dynamic servlet = servletContext.addServlet("dispatcher",new DispatcherServlet(ctx)); // 3
servlet.addMapping("/");
servlet.setLoadOnStartup(1);
}
@Override
public void onStartup(ServletContext servletContext)
throws ServletException {
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
ctx.register(MyMvcConfig.class);
ctx.setServletContext(servletContext); // ②
Dynamic servlet = servletContext.addServlet("dispatcher",new DispatcherServlet(ctx)); // 3
servlet.addMapping("/");
servlet.setLoadOnStartup(1);
}
@Override
public void onStartup(ServletContext servletContext)
throws ServletException {
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
ctx.register(MyMvcConfig.class);
ctx.setServletContext(servletContext); // ②
Dynamic servlet = servletContext.addServlet("dispatcher",new DispatcherServlet(ctx)); // 3
servlet.addMapping("/");
servlet.setLoadOnStartup(1);
servlet.setAsyncSupported(true);//①
}
public void onStartup(ServletContext servletContext) {
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
ctx.setConfigLocation("org.audt4j.demo.hibernate.config");
servletContext.addListener(new ContextLoaderListener(ctx));
ctx.setServletContext(servletContext);
Dynamic servlet = servletContext.addServlet("dispatcher",
new DispatcherServlet(ctx));
servlet.addMapping("/*");
servlet.setLoadOnStartup(1);
FilterRegistration.Dynamic springSecurityFilterChain = servletContext
.addFilter("springSecurityFilterChain",
new DelegatingFilterProxy());
springSecurityFilterChain.addMappingForUrlPatterns(null, false, "/*");
springSecurityFilterChain.setAsyncSupported(true);
}
@Override
protected void customizeRegistration(Dynamic registration) {
registration.setLoadOnStartup(2);
}