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

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

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

Undertow.getListenerInfo介绍

暂无

代码示例

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

  1. int getPort() {
  2. return ((InetSocketAddress) server.getListenerInfo().get(0).getAddress()).getPort();
  3. }
  4. }

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

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

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

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

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

  1. protected int initServer() throws Exception {
  2. DeploymentInfo servletBuilder = Servlets.deployment()
  3. .setClassLoader(getClass().getClassLoader())
  4. .setContextPath("/")
  5. .setDeploymentName("test.war");
  6. init(servletBuilder);
  7. DeploymentManager manager = Servlets.defaultContainer().addDeployment(servletBuilder);
  8. manager.deploy();
  9. server = Undertow.builder()
  10. .addHttpListener(0, "127.0.0.1")
  11. .setHandler(manager.start()).build();
  12. server.start();
  13. return ((InetSocketAddress) server.getListenerInfo().get(0).getAddress()).getPort();
  14. }

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

  1. @Setup(Level.Trial) public void init() throws Exception {
  2. server = Undertow.builder()
  3. .addHttpListener(0, "127.0.0.1")
  4. .setHandler(exchange -> {
  5. exchange.getResponseHeaders().put(CONTENT_TYPE, "text/plain; charset=UTF-8");
  6. exchange.getResponseSender().send("hello world");
  7. }).build();
  8. server.start();
  9. baseUrl = "http://127.0.0.1:" +
  10. ((InetSocketAddress) server.getListenerInfo().get(0).getAddress()).getPort();
  11. client = newClient();
  12. tracedClient = newClient(HttpTracing.create(
  13. Tracing.newBuilder().spanReporter(Reporter.NOOP).build()
  14. ));
  15. unsampledClient = newClient(HttpTracing.create(
  16. Tracing.newBuilder().sampler(Sampler.NEVER_SAMPLE).spanReporter(Reporter.NOOP).build()
  17. ));
  18. }

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

  1. public void healthy()
  2. {
  3. startupDuration = Duration.ofMillis(System.currentTimeMillis() - startTime);
  4. for(ListenerInfo info : undertow.getListenerInfo())
  5. {
  6. log.debug("listener info: " + info);
  7. SocketAddress address = info.getAddress();
  8. if(address != null)
  9. {
  10. ports.add( ((java.net.InetSocketAddress) address).getPort());
  11. }
  12. }
  13. printStatus();
  14. running.set(true);
  15. }

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

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

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

  1. @BeforeAll
  2. static void startServer() {
  3. server = Undertow.builder()
  4. .addHttpListener(0, "127.0.0.1")
  5. .setHandler(exchange -> {
  6. if (handler != null) {
  7. handler.handleRequest(exchange);
  8. }
  9. }).build();
  10. server.start();
  11. port = ((InetSocketAddress) server.getListenerInfo().get(0).getAddress()).getPort();
  12. }

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

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

相关文章