org.apache.catalina.Wrapper.setLoadOnStartup()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(189)

本文整理了Java中org.apache.catalina.Wrapper.setLoadOnStartup()方法的一些代码示例,展示了Wrapper.setLoadOnStartup()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Wrapper.setLoadOnStartup()方法的具体详情如下:
包路径:org.apache.catalina.Wrapper
类名称:Wrapper
方法名:setLoadOnStartup

Wrapper.setLoadOnStartup介绍

[英]Set the load-on-startup order value (negative value means load on first call).
[中]设置启动时加载顺序值(负值表示第一次调用时加载)。

代码示例

代码示例来源:origin: org.springframework.boot/spring-boot

private void addJspServlet(Context context) {
  Wrapper jspServlet = context.createWrapper();
  jspServlet.setName("jsp");
  jspServlet.setServletClass(getJsp().getClassName());
  jspServlet.addInitParameter("fork", "false");
  getJsp().getInitParameters().forEach(jspServlet::addInitParameter);
  jspServlet.setLoadOnStartup(3);
  context.addChild(jspServlet);
  context.addServletMappingDecoded("*.jsp", "jsp");
  context.addServletMappingDecoded("*.jspx", "jsp");
}

代码示例来源:origin: org.springframework.boot/spring-boot

private void addDefaultServlet(Context context) {
  Wrapper defaultServlet = context.createWrapper();
  defaultServlet.setName("default");
  defaultServlet.setServletClass("org.apache.catalina.servlets.DefaultServlet");
  defaultServlet.addInitParameter("debug", "0");
  defaultServlet.addInitParameter("listings", "false");
  defaultServlet.setLoadOnStartup(1);
  // Otherwise the default location of a Spring DispatcherServlet cannot be set
  defaultServlet.setOverridable(true);
  context.addChild(defaultServlet);
  context.addServletMappingDecoded("/", "default");
}

代码示例来源:origin: OryxProject/oryx

wrapper.setLoadOnStartup(1);
wrapper.setMultipartConfigElement(new MultipartConfigElement(""));

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

@Override
public void setLoadOnStartup(int loadOnStartup) {
  wrapper.setLoadOnStartup(loadOnStartup);
}

代码示例来源:origin: pippo-java/pippo

wrapper.setLoadOnStartup(1);
wrapper.setServlet(pippoServlet);
context.addChild(wrapper);

代码示例来源:origin: codefollower/Tomcat-Research

@Override
public void setLoadOnStartup(int loadOnStartup) {
  wrapper.setLoadOnStartup(loadOnStartup);
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

@Override
public void setLoadOnStartup(int loadOnStartup) {
  wrapper.setLoadOnStartup(loadOnStartup);
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

@Override
public void setLoadOnStartup(int loadOnStartup) {
  wrapper.setLoadOnStartup(loadOnStartup);
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

@Override
public void setLoadOnStartup(int loadOnStartup) {
  wrapper.setLoadOnStartup(loadOnStartup);
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

@Override
public void setLoadOnStartup(int loadOnStartup) {
  wrapper.setLoadOnStartup(loadOnStartup);
}

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

@Override
public void setLoadOnStartup(int loadOnStartup) {
  wrapper.setLoadOnStartup(loadOnStartup);
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

@Override
public void setLoadOnStartup(int loadOnStartup) {
  wrapper.setLoadOnStartup(loadOnStartup);
}

代码示例来源:origin: myrrix/myrrix-recommender

private static Wrapper addServlet(Context context, Servlet servlet, String path) {
 String name = servlet.getClass().getSimpleName();
 Wrapper servletWrapper = Tomcat.addServlet(context, name, servlet);
 servletWrapper.setLoadOnStartup(1);
 context.addServletMapping(path, name);
 return servletWrapper;
}

代码示例来源:origin: chrismattmann/lucene-geo-gazetteer

public static void launchService(int port, String indexPath)
    throws IOException, LifecycleException {
  Tomcat server = new Tomcat();
  Context context = server.addContext("/", new File(".").getAbsolutePath());
  System.setProperty(INDEX_PATH_PROP, indexPath);
  Wrapper servlet = context.createWrapper();
  servlet.setName("CXFNonSpringJaxrs");
  servlet.setServletClass(CXFNonSpringJaxrsServlet.class.getName());
  servlet.addInitParameter("jaxrs.serviceClasses", SearchResource.class.getName() + " " + HealthCheckAPI.class.getName());
  servlet.setLoadOnStartup(1);
  context.addChild(servlet);
  context.addServletMapping("/api/*", "CXFNonSpringJaxrs");
  System.out.println("Starting Embedded Tomcat on port : " + port );
  server.setPort(port);
  server.start();
  server.getServer().await();
}

代码示例来源:origin: zzzzbw/doodle

public TomcatServer(Configuration configuration) {
  try {
    this.tomcat = new Tomcat();
    tomcat.setBaseDir(configuration.getDocBase());
    tomcat.setPort(configuration.getServerPort());
    File root = getRootFolder();
    File webContentFolder = new File(root.getAbsolutePath(), configuration.getResourcePath());
    if (!webContentFolder.exists()) {
      webContentFolder = Files.createTempDirectory("default-doc-base").toFile();
    }
    log.info("Tomcat:configuring app with basedir: [{}]", webContentFolder.getAbsolutePath());
    StandardContext ctx = (StandardContext) tomcat.addWebapp(configuration.getContextPath(), webContentFolder.getAbsolutePath());
    ctx.setParentClassLoader(this.getClass().getClassLoader());
    WebResourceRoot resources = new StandardRoot(ctx);
    ctx.setResources(resources);
    tomcat.addServlet(configuration.getContextPath(), "dispatcherServlet", new DispatcherServlet()).setLoadOnStartup(0);
    ctx.addServletMappingDecoded("/*", "dispatcherServlet");
  } catch (Exception e) {
    log.error("初始化Tomcat失败", e);
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: com.tomitribe.tribestream/tribestream-container

public ProgrammaticContext addServlet(final String name, final Class<?> type, final String mapping, final String... initParams) {
  final Wrapper wrapper = createWrapper();
  wrapper.setServletClass(type.getName());
  wrapper.setName(name);
  if (initParams != null && initParams.length > 0) {
    for (int i = 0; i < initParams.length; i+=2) {
      wrapper.addInitParameter(initParams[i], initParams[i+1]);
    }
  }
  wrapper.setLoadOnStartup(1); // otherwise we would miss reposgitry integration at least
  addChild(wrapper);
  addServletMapping(mapping, wrapper.getName(), false);
  return this;
}

代码示例来源:origin: nutzam/nutzboot

private void addDefaultServlet() {
  Wrapper defaultServlet = this.tomcatContext.createWrapper();
  defaultServlet.setName("default");
  defaultServlet.setServletClass("org.apache.catalina.servlets.DefaultServlet");
  defaultServlet.addInitParameter("debug", "0");
  defaultServlet.addInitParameter("listings", "false");
  defaultServlet.setLoadOnStartup(1);
  defaultServlet.setOverridable(true);
  this.tomcatContext.addChild(defaultServlet);
  addServletMapping("/", "default");
}

代码示例来源:origin: org.gatein.wci/wci-tomcat7

protected void performStartup() throws Exception
{
 try
 {
   String className = getCommandServletClassName();
   if (null == className)
   {
    return;
   }
   commandServlet = context.createWrapper();
   commandServlet.setName(GATEIN_SERVLET_NAME);
   commandServlet.setLoadOnStartup(GATEIN_SERVLET_LOAD_ON_STARTUP);
   commandServlet.setServletClass(className);
   context.addChild(commandServlet);
   context.addServletMapping(GATEIN_SERVLET_PATH, GATEIN_SERVLET_NAME);
 }
 catch (Exception e)
 {
   cleanup();
   throw e;
 }
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

servlet.setLoadOnStartup(1);
servlet.setOverridable(true);
    ctx, "jsp", "org.apache.jasper.servlet.JspServlet");
servlet.addInitParameter("fork", "false");
servlet.setLoadOnStartup(3);
servlet.setOverridable(true);

代码示例来源:origin: org.dbflute.tomcat/tomcat-boot

protected void initWebappDefaultsWithoutJsp(Context ctx, String[] defaultMimeMappings) {
  servlet.setLoadOnStartup(1);
  servlet.setOverridable(true);

相关文章