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

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

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

HttpServer.handle介绍

[英]Attach an IO handler to react on connected server
[中]附加IO处理程序以在连接的服务器上作出反应

代码示例

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

private DisposableServer startHttpServer() {
  if (this.lifecycleTimeout != null) {
    return this.httpServer.handle(this.handlerAdapter)
        .bindNow(this.lifecycleTimeout);
  }
  return this.httpServer.handle(this.handlerAdapter).bindNow();
}

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

@Override
protected void startInternal() {
  DisposableServer server = this.reactorServer.handle(this.reactorHandler).bind().block();
  setPort(server.address().getPort());
  this.serverRef.set(server);
}

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

@Override
protected void startInternal() {
  DisposableServer server = this.reactorServer.handle(this.reactorHandler).bind().block();
  setPort(server.address().getPort());
  this.serverRef.set(server);
}

代码示例来源:origin: spring-cloud/spring-cloud-gateway

@Override
protected void startInternal() {
  DisposableServer server = this.reactorServer.handle(this.reactorHandler).bind().block();
  setPort(server.address().getPort());
  this.serverRef.set(server);
}

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

@Override
 public Mono<CloseableChannel> start(ConnectionAcceptor acceptor) {
  Objects.requireNonNull(acceptor, "acceptor must not be null");

  return server
    .handle(
      (request, response) -> {
       transportHeaders.get().forEach(response::addHeader);
       return response.sendWebsocket(WebsocketRouteTransport.newHandler(acceptor));
      })
    .bind()
    .map(CloseableChannel::new);
 }
}

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

/**
 * Define routes for the server through the provided {@link HttpServerRoutes} builder.
 *
 * @param routesBuilder provides a route builder to be mutated in order to define routes.
 * @return a new {@link HttpServer} starting the router on subscribe
 */
public final HttpServer route(Consumer<? super HttpServerRoutes> routesBuilder) {
  Objects.requireNonNull(routesBuilder, "routeBuilder");
  HttpServerRoutes routes = HttpServerRoutes.newRoutes();
  routesBuilder.accept(routes);
  return handle(routes);
}

代码示例来源: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();
}

相关文章