reactor.netty.http.server.HttpServer.host()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(369)

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

HttpServer.host介绍

[英]The host to which this server should bind.
[中]此服务器应绑定到的主机。

代码示例

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

@Override
protected void initServer() throws Exception {
  SelfSignedCertificate cert = new SelfSignedCertificate();
  SslContextBuilder builder = SslContextBuilder.forServer(cert.certificate(), cert.privateKey());
  this.reactorHandler = createHttpHandlerAdapter();
  this.reactorServer = reactor.netty.http.server.HttpServer.create()
    .host(getHost())
    .port(getPort())
    .secure(spec -> spec.sslContext(builder).defaultConfiguration(DefaultConfigurationType.TCP));
}

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

/**
 * Creates a new instance
 *
 * @param bindAddress the address to bind to
 * @param port the port to bind to
 * @return a new instance
 * @throws NullPointerException if {@code bindAddress} is {@code null}
 */
public static WebsocketServerTransport create(String bindAddress, int port) {
 Objects.requireNonNull(bindAddress, "bindAddress must not be null");
 HttpServer httpServer = HttpServer.create().host(bindAddress).port(port);
 return create(httpServer);
}

代码示例来源:origin: hantsy/spring-reactive-sample

@Profile("default")
@Bean
public HttpServer nettyHttpServer(ApplicationContext context) {
  HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
  ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
  HttpServer httpServer = HttpServer.create().host("localhost").port(this.port);
  return httpServer.handle(adapter);
}

代码示例来源:origin: hantsy/spring-reactive-sample

@Profile("default")
@Bean
public HttpServer nettyHttpServer(ApplicationContext context) {
  HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
  ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
  HttpServer httpServer = HttpServer.create().host("localhost").port(this.port);
  return httpServer.handle(adapter);
}

代码示例来源:origin: hantsy/spring-reactive-sample

@Profile("default")
@Bean
public HttpServer nettyHttpServer(ApplicationContext context) {
  HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
  ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
  HttpServer httpServer = HttpServer.create().host("localhost").port(this.port);
  return httpServer.handle(adapter);
}

代码示例来源:origin: hantsy/spring-reactive-sample

@Profile("default")
@Bean
public HttpServer nettyHttpServer(ApplicationContext context) {
  HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
  ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
  HttpServer httpServer = HttpServer.create().host("localhost").port(this.port);
  return httpServer.handle(adapter);
}

代码示例来源:origin: hantsy/spring-reactive-sample

@Profile("default")
@Bean
public HttpServer nettyHttpServer(ApplicationContext context) {
  HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
  ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
  HttpServer httpServer = HttpServer.create().host("localhost").port(this.port);
  return httpServer.handle(adapter);
}

代码示例来源:origin: hantsy/spring-reactive-sample

@Profile("default")
@Bean
public HttpServer nettyHttpServer(ApplicationContext context) {
  HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
  ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
  HttpServer httpServer = HttpServer.create().host("localhost").port(this.port);
  return httpServer.handle(adapter);
}

代码示例来源:origin: hantsy/spring-reactive-sample

@Profile("default")
@Bean
public HttpServer nettyHttpServer(ApplicationContext context) {
  HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
  ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
  HttpServer httpServer = HttpServer.create().host("localhost").port(this.port);
  return httpServer.handle(adapter);
}

代码示例来源:origin: hantsy/spring-reactive-sample

@Profile("default")
@Bean
public HttpServer nettyHttpServer(ApplicationContext context) {
  HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
  ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
  HttpServer httpServer = HttpServer.create().host("localhost").port(this.port);
  return httpServer.handle(adapter);
}

代码示例来源:origin: hantsy/spring-reactive-sample

@Profile("default")
@Bean
public HttpServer nettyHttpServer(ApplicationContext context) {
  HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
  ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
  HttpServer httpServer = HttpServer.create().host("localhost").port(this.port);
  return httpServer.handle(adapter);
}

代码示例来源:origin: hantsy/spring-reactive-sample

@Profile("default")
@Bean
public HttpServer nettyHttpServer(ApplicationContext context) {
  HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
  ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
  HttpServer httpServer = HttpServer.create().host("localhost").port(this.port);
  return httpServer.handle(adapter);
}

代码示例来源:origin: hantsy/spring-reactive-sample

@Profile("default")
@Bean
public HttpServer nettyHttpServer(ApplicationContext context) {
  HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
  ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
  HttpServer httpServer = HttpServer.create().host("localhost").port(this.port);
  return httpServer.handle(adapter);
}

代码示例来源:origin: hantsy/spring-reactive-sample

@Profile("default")
@Bean
public HttpServer nettyHttpServer(ApplicationContext context) {
  HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
  ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
  HttpServer httpServer = HttpServer.create().host("localhost").port(this.port);
  return httpServer.handle(adapter);
}

代码示例来源:origin: hantsy/spring-reactive-sample

@Profile("default")
@Bean
public HttpServer nettyHttpServer(ApplicationContext context) {
  HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
  ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
  HttpServer httpServer = HttpServer.create().host("localhost").port(this.port);
  return httpServer.handle(adapter);
}

代码示例来源:origin: hantsy/spring-reactive-sample

@Profile("default")
@Bean
public HttpServer nettyHttpServer(ApplicationContext context) {
  HttpHandler handler = WebHttpHandlerBuilder.applicationContext(context).build();
  ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(handler);
  HttpServer httpServer = HttpServer.create().host("localhost").port(this.port);
  return httpServer.handle(adapter);
}

代码示例来源:origin: reactor/reactor-netty

@Test
public void httpPortWithAddress() {
  DisposableServer blockingFacade = HttpServer.create()
                        .port(8080)
                        .host("localhost")
                        .handle((req, resp) -> resp.sendNotFound())
                        .wiretap(true)
                        .bindNow();
  blockingFacade.disposeNow();
  assertThat(blockingFacade.address().getPort())
      .isEqualTo(8080);
}

代码示例来源:origin: reactor/reactor-netty

@Before
public void setUp() {
  server = HttpServer.create()
            .port(7000)
            .host("localhost")
            .handle((req, res) -> res.sendString(Mono.just("test")))
            .wiretap(true)
            .bindNow();
}

代码示例来源:origin: reactor/reactor-netty

@Test
public void gettingOptionsDuplicates() {
  HttpServer server = HttpServer.create()
                 .port(123)
                 .host(("foo"))
                 .compress(true);
  assertThat(server.tcpConfiguration().configure())
       .isNotSameAs(HttpServer.DEFAULT_TCP_SERVER)
       .isNotSameAs(server.tcpConfiguration().configure());
}

代码示例来源:origin: reactor/reactor-netty

@Test
@Ignore
public void startProxyServer() {
  HttpServer server = HttpServer.create()
                 .port(PROXY_PORT)
                 .host("0.0.0.0");
  server.route(routes -> routes.get("/0/**", this::proxy))
     .wiretap(true)
     .bindNow();
}

相关文章