io.undertow.Undertow.getListenerInfo()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(159)

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

Undertow.getListenerInfo介绍

暂无

代码示例

代码示例来源:origin: openzipkin/brave

int getPort() {
  return ((InetSocketAddress) server.getListenerInfo().get(0).getAddress()).getPort();
 }
}

代码示例来源:origin: spring-projects/spring-framework

@Override
public void start() throws Exception {
  this.server.start();
  Undertow.ListenerInfo info = this.server.getListenerInfo().get(0);
  this.port = ((InetSocketAddress) info.getAddress()).getPort();
}

代码示例来源:origin: spring-projects/spring-framework

@Override
protected void startInternal() {
  this.server.start();
  Undertow.ListenerInfo info = this.server.getListenerInfo().get(0);
  setPort(((InetSocketAddress) info.getAddress()).getPort());
}

代码示例来源:origin: openzipkin/brave

protected int initServer() throws Exception {
 DeploymentInfo servletBuilder = Servlets.deployment()
   .setClassLoader(getClass().getClassLoader())
   .setContextPath("/")
   .setDeploymentName("test.war");
 init(servletBuilder);
 DeploymentManager manager = Servlets.defaultContainer().addDeployment(servletBuilder);
 manager.deploy();
 server = Undertow.builder()
   .addHttpListener(0, "127.0.0.1")
   .setHandler(manager.start()).build();
 server.start();
 return ((InetSocketAddress) server.getListenerInfo().get(0).getAddress()).getPort();
}

代码示例来源:origin: openzipkin/brave

@Setup(Level.Trial) public void init() throws Exception {
 server = Undertow.builder()
   .addHttpListener(0, "127.0.0.1")
   .setHandler(exchange -> {
    exchange.getResponseHeaders().put(CONTENT_TYPE, "text/plain; charset=UTF-8");
    exchange.getResponseSender().send("hello world");
   }).build();
 server.start();
 baseUrl = "http://127.0.0.1:" +
   ((InetSocketAddress) server.getListenerInfo().get(0).getAddress()).getPort();
 client = newClient();
 tracedClient = newClient(HttpTracing.create(
   Tracing.newBuilder().spanReporter(Reporter.NOOP).build()
 ));
 unsampledClient = newClient(HttpTracing.create(
   Tracing.newBuilder().sampler(Sampler.NEVER_SAMPLE).spanReporter(Reporter.NOOP).build()
 ));
}

代码示例来源:origin: noboomu/proteus

public void healthy()
{
  startupDuration = Duration.ofMillis(System.currentTimeMillis() - startTime);
  for(ListenerInfo info : undertow.getListenerInfo())
  {
    log.debug("listener info: " + info);
    SocketAddress address = info.getAddress();
    
    if(address != null)
    { 
      ports.add( ((java.net.InetSocketAddress) address).getPort());
    }
  }
  printStatus();
  
  running.set(true); 
}

代码示例来源:origin: StubbornJava/StubbornJava

public Undertow start() {
  Undertow undertow = undertowBuilder.build();
  undertow.start();
  /*
   *  Undertow logs this on debug but we generally set 3rd party
   *  default logger levels to info so we log it here. If it wasn't using the
   *  io.undertow context we could turn on just that logger but no big deal.
   */
  undertow.getListenerInfo()
      .stream()
      .forEach(listenerInfo -> logger.info(listenerInfo.toString()));
  return undertow;
}

代码示例来源:origin: elastic/apm-agent-java

@BeforeAll
static void startServer() {
  server = Undertow.builder()
    .addHttpListener(0, "127.0.0.1")
    .setHandler(exchange -> {
      if (handler != null) {
        handler.handleRequest(exchange);
      }
    }).build();
  server.start();
  port = ((InetSocketAddress) server.getListenerInfo().get(0).getAddress()).getPort();
}

代码示例来源:origin: io.digdag/digdag-guice-rs-server-undertow

for (Undertow.ListenerInfo listenerInfo : server.getListenerInfo()) {
  OpenListener listener = httpListenerOf(listenerInfo);
  SocketAddress listenerAddress = listenerInfo.getAddress();

相关文章