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

x33g5p2x  于2022-01-30 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(177)

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

Server.findServices介绍

[英]Return the set of Services defined within this Server.
[中]返回此服务器中定义的服务集。

代码示例

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

static String toString(org.apache.catalina.Server server) {
  requireNonNull(server, "server");
  final Service[] services = server.findServices();
  final String serviceName;
  if (services.length == 0) {
    serviceName = "<unknown>";
  } else {
    serviceName = services[0].getName();
  }
  final StringBuilder buf = new StringBuilder(128);
  buf.append("(serviceName: ");
  buf.append(serviceName);
  if (TomcatVersion.major() >= 8) {
    buf.append(", catalinaBase: ");
    buf.append(server.getCatalinaBase());
  }
  buf.append(')');
  return buf.toString();
}

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

private void addPreviouslyRemovedConnectors() {
  Service[] services = this.tomcat.getServer().findServices();
  for (Service service : services) {
    Connector[] connectors = this.serviceConnectors.get(service);
    if (connectors != null) {
      for (Connector connector : connectors) {
        service.addConnector(connector);
        if (!this.autoStart) {
          stopProtocolHandler(connector);
        }
      }
      this.serviceConnectors.remove(service);
    }
  }
}

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

private void removeServiceConnectors() {
  for (Service service : this.tomcat.getServer().findServices()) {
    Connector[] connectors = service.findConnectors().clone();
    this.serviceConnectors.put(service, connectors);
    for (Connector connector : connectors) {
      service.removeConnector(connector);
    }
  }
}

代码示例来源:origin: stackoverflow.com

Server server = ServerFactory.getServer();
   Service[] services = server.findServices();
   for (Service service : services) {
     for (Connector connector : service.findConnectors()) {
       ProtocolHandler protocolHandler = connector.getProtocolHandler();
       if (protocolHandler instanceof Http11Protocol
         || protocolHandler instanceof Http11AprProtocol
         || protocolHandler instanceof Http11NioProtocol) {
         serverPort = connector.getPort();
         System.out.println("HTTP Port: " + connector.getPort());
       }
     }
   }

代码示例来源:origin: stackoverflow.com

e.printStackTrace();
Service[] services = server.findServices();
for (Service service : services) {
  for (Connector connector : service.findConnectors()) {

代码示例来源:origin: org.apache.meecrowave/meecrowave-core

private void server(final Server s) {
  server = s;
  connector = server != null && server.findServices().length > 0 && server.findServices()[0].findConnectors().length > 0 ?
      server.findServices()[0].findConnectors()[0] : null;
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-tomcat6

public Service getService(String serviceName) {
  Service service;
  if (serviceName == null) {
    Service[] services = server.findServices();
    if (services == null || services.length == 0) throw new IllegalStateException("No services in server");
    if (services.length > 1) throw new IllegalStateException("More than one service in server.  Provide name of desired server" + Arrays.asList(services));
    service = services[0];
  } else {
    service = server.findService(serviceName);
  }
  return service;
}

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

/**
 * Get the service object. Can be used to add more
 * connectors and few other global settings.
 * @return The service
 */
public Service getService() {
  return getServer().findServices()[0];
}

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

/**
 * Get the service object. Can be used to add more
 * connectors and few other global settings.
 * @return The service
 */
public Service getService() {
  return getServer().findServices()[0];
}

代码示例来源:origin: org.apache.meecrowave/meecrowave-core

private Connector findFirstConnector() {
  return Stream.of(tomcat.getServer().findServices())
      .flatMap(s -> Stream.of(s.findConnectors()))
      .findFirst()
      .orElse(null);
}

代码示例来源:origin: apache/meecrowave

private Connector findFirstConnector() {
  return Stream.of(tomcat.getServer().findServices())
      .flatMap(s -> Stream.of(s.findConnectors()))
      .findFirst()
      .orElse(null);
}

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

private void registerListenersForServer(Server server) {
  for (Service service : server.findServices()) {
    Engine engine = service.getContainer();
    if (engine != null) {
      engine.addContainerListener(this);
      registerListenersForEngine(engine);
    }
  }
}

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

private void registerListenersForServer(Server server) {
  for (Service service : server.findServices()) {
    Engine engine = (Engine) service.getContainer();
    engine.addContainerListener(this);
    registerListenersForEngine(engine);
  }
}

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

private void registerListenersForServer(Server server) {
  for (Service service : server.findServices()) {
    Engine engine = (Engine) service.getContainer();
    engine.addContainerListener(this);
    registerListenersForEngine(engine);
  }
}

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

private void registerListenersForServer(Server server) {
  for (Service service : server.findServices()) {
    Engine engine = service.getContainer();
    if (engine != null) {
      engine.addContainerListener(this);
      registerListenersForEngine(engine);
    }
  }
}

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

private void registerListenersForServer(Server server) {
  for (Service service : server.findServices()) {
    Engine engine = (Engine) service.getContainer();
    engine.addContainerListener(this);
    registerListenersForEngine(engine);
  }
}

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

private void registerListenersForServer(Server server) {
  for (Service service : server.findServices()) {
    Engine engine = (Engine) service.getContainer();
    engine.addContainerListener(this);
    registerListenersForEngine(engine);
  }
}

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

public TomcatSecurityService() {
  final Server server = TomcatHelper.getServer();
  for (final Service service : server.findServices()) {
    if (service.getContainer() instanceof Engine) {
      final Engine engine = (Engine) service.getContainer();
      if (engine.getRealm() != null) {
        defaultRealm = engine.getRealm();
        break;
      }
    }
  }
}

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

public TomcatSecurityService() {
  Server server = ServerFactory.getServer();
  for (Service service : server.findServices()) {
    if (service.getContainer() instanceof Engine) {
      Engine engine = (Engine) service.getContainer();
      if (engine.getRealm() != null) {
        defaultRealm = engine.getRealm();
        break;
      }
    }
  }
}

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

public TomcatSecurityService() {
  Server server = TomcatHelper.getServer();
  for (Service service : server.findServices()) {
    if (service.getContainer() instanceof Engine) {
      Engine engine = (Engine) service.getContainer();
      if (engine.getRealm() != null) {
        defaultRealm = engine.getRealm();
        break;
      }
    }
  }
}

相关文章