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

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

本文整理了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

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

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

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

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

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

相关文章