io.reactivex.netty.protocol.http.client.HttpClient.newClient()方法的使用及代码示例

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

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

HttpClient.newClient介绍

暂无

代码示例

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

private static HttpClient<ByteBuf, ByteBuf> getDefaultHttpClientProvider(URI url) {
  boolean secure = "wss".equals(url.getScheme());
  int port = (url.getPort() > 0 ? url.getPort() : secure ? 443 : 80);
  return HttpClient.newClient(url.getHost(), port);
}

代码示例来源:origin: nurkiewicz/rxjava-book-examples

@Test
public void sample_22() throws Exception {
  Observable<URL> sources = Observable.just(new URL("http://www.google.com"));
  Observable<ByteBuf> packets =
      sources
          .flatMap(url -> HttpClient
              .newClient(url.getHost(), url.getPort())
              .createGet(url.getPath()))
          .flatMap(HttpClientResponse::getContent);
}

代码示例来源:origin: nurkiewicz/rxjava-book-examples

@Test
public void sample_9() throws Exception {
  Observable<ByteBuf> response = HttpClient
      .newClient("example.com", 80)
      .createGet("/")
      .flatMap(HttpClientResponse::getContent);
  response
      .map(bb -> bb.toString(UTF_8))
      .subscribe(System.out::println);
}

相关文章