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

x33g5p2x  于2022-01-19 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(114)

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

Engine.getService介绍

[英]Return the Service with which we are associated (if any).
[中]返回与我们关联的Service(如果有)。

代码示例

代码示例来源:origin: line/armeria

@Test
public void verifySingleConnector() {
  // Relevant to Tomcat 9.0
  assertThat(applicationContext).isInstanceOf(WebServerApplicationContext.class);
  WebServer webServer = ((WebServerApplicationContext) applicationContext).getWebServer();
  assertThat(webServer).isInstanceOf(TomcatWebServer.class);
  assertThat(((TomcatWebServer) webServer).getTomcat()
                      .getEngine()
                      .getService()
                      .findConnectors()).hasSize(1);
}

代码示例来源:origin: psi-probe/psi-probe

@Override
public void setWrapper(Wrapper wrapper) {
 Valve valve = createValve();
 if (wrapper != null) {
  host = (Host) wrapper.getParent().getParent();
  Engine engine = (Engine) host.getParent();
  Service service = engine.getService();
  connectors = service.findConnectors();
  try {
   deployerOName =
     new ObjectName(host.getParent().getName() + ":type=Deployer,host=" + host.getName());
  } catch (MalformedObjectNameException e) {
   logger.trace("", e);
  }
  host.getPipeline().addValve(valve);
  mbeanServer = ManagementFactory.getPlatformMBeanServer();
 } else if (host != null) {
  host.getPipeline().removeValve(valve);
 }
}

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

/**
 * Return the Service to which this container belongs.
 * @param container The container to start from
 * @return the Service, or null if not found
 */
public static Service getService(Container container) {
  while (container != null && !(container instanceof Engine)) {
    container = container.getParent();
  }
  if (container == null) {
    return null;
  }
  return ((Engine) container).getService();
}

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

private Connector[] getConnectors() {
    Engine e = (Engine) host.getParent();
    Service s = e.getService();
    return s.findConnectors();
  }
}

代码示例来源:origin: org.jboss.mod_cluster/mod_cluster

/**
* Constructs a new CatalinaEngine that wraps the specified catalina engine
* @param engine a catalina engine
*/
public CatalinaEngine(org.apache.catalina.Engine engine, MBeanServer mbeanServer)
{
 this(engine, new CatalinaServer(engine.getService().getServer(), mbeanServer));
}

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

private Connector[] getConnectors() {
    Engine e = (Engine) host.getParent();
    Service s = e.getService();
    return s.findConnectors();
  }
}

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

private Server getServer() {
  Container c = context;
  while (c != null && !(c instanceof Engine)) {
    c = c.getParent();
  }
  if (c == null) {
    return null;
  }
  Service s = ((Engine)c).getService();
  if (s == null) {
    return null;
  }
  return s.getServer();
}

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

private Server getServer() {
  if (container instanceof Server) {
    return (Server) container;
  }
  if (container instanceof Context) {
    // Could do this in one go. Lots of casts so split out for clarity
    Engine engine =
      (Engine) ((Context) container).getParent().getParent();
    return engine.getService().getServer();
  }
  return null;
}

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

private Server getServer() {
  if (container instanceof Server) {
    return (Server) container;
  }
  if (container instanceof Context) {
    // Could do this in one go. Lots of casts so split out for clarity
    Engine engine =
      (Engine) ((Context) container).getParent().getParent();
    return engine.getService().getServer();
  }
  return null;
}

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

private Server getServer() {
  if (container instanceof Server) {
    return (Server) container;
  }
  if (container instanceof Context) {
    // Could do this in one go. Lots of casts so split out for clarity
    Engine engine =
      (Engine) ((Context) container).getParent().getParent();
    return engine.getService().getServer();
  }
  return null;
}

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

private Server getServer() {
  if (container instanceof Server) {
    return (Server) container;
  }
  if (container instanceof Context) {
    // Could do this in one go. Lots of casts so split out for clarity
    Engine engine =
      (Engine) ((Context) container).getParent().getParent();
    return engine.getService().getServer();
  }
  return null;
}

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

private Server getServer() {
  if (container instanceof Server) {
    return (Server) container;
  }
  if (container instanceof Context) {
    // Could do this in one go. Lots of casts so split out for clarity
    Engine engine =
      (Engine) ((Context) container).getParent().getParent();
    return engine.getService().getServer();
  }
  return null;
}

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

private Server getServer() {
  if (container instanceof Server) {
    return (Server) container;
  }
  if (container instanceof Context) {
    // Could do this in one go. Lots of casts so split out for clarity
    Engine engine =
      (Engine) ((Context) container).getParent().getParent();
    return engine.getService().getServer();
  }
  return null;
}

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

private Server getServer() {
  if (container instanceof Server) {
    return (Server) container;
  }
  if (container instanceof Context) {
    // Could do this in one go. Lots of casts so split out for clarity
    Engine engine =
      (Engine) ((Context) container).getParent().getParent();
    return engine.getService().getServer();
  }
  return null;
}

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

private Server getServer() {
  if (container instanceof Server) {
    return (Server) container;
  }
  if (container instanceof Context) {
    // Could do this in one go. Lots of casts so split out for clarity
    Engine engine =
      (Engine) ((Context) container).getParent().getParent();
    return engine.getService().getServer();
  }
  return null;
}

代码示例来源:origin: modcluster/mod_cluster

@Override
public Engine createEngine(org.apache.catalina.Engine engine) {
  return this.engineFactory.createEngine(this, engine, this.createServer(engine.getService().getServer()));
}

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

private javax.naming.Context getGlobalNamingContext() {
  if (container instanceof Context) {
    Engine e = (Engine) ((Context) container).getParent().getParent();
    return e.getService().getServer().getGlobalNamingContext();
  }
  return null;
}

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

private javax.naming.Context getGlobalNamingContext() {
  if (container instanceof Context) {
    Engine e = (Engine) ((Context) container).getParent().getParent();
    return e.getService().getServer().getGlobalNamingContext();
  }
  return null;
}

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

/**
 * Construct a new instance of this class, associated with the specified
 * Context instance.
 *
 * @param context The associated Context instance
 */
public ApplicationContext(StandardContext context) {
  super();
  this.context = context;
  this.service = ((Engine) context.getParent().getParent()).getService();
  this.sessionCookieConfig = new ApplicationSessionCookieConfig(context);
  // Populate session tracking modes
  populateSessionTrackingModes();
}

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

/**
 * Construct a new instance of this class, associated with the specified
 * Context instance.
 *
 * @param context The associated Context instance
 */
public ApplicationContext(StandardContext context) {
  super();
  this.context = context;
  this.service = ((Engine) context.getParent().getParent()).getService();
  this.sessionCookieConfig = new ApplicationSessionCookieConfig(context);
  // Populate session tracking modes
  populateSessionTrackingModes();
}

相关文章