reactor.netty.http.client.HttpClient.put()方法的使用及代码示例

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

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

HttpClient.put介绍

[英]HTTP PUT to connect the HttpClient.
[中]HTTP PUT用于连接HttpClient。

代码示例

代码示例来源:origin: com.rabbitmq/http-client

private Mono<HttpResponse> doPut(String... pathSegments) {
  return client.headersWhen(authorizedHeader())
    .headers(JSON_HEADER)
    .chunkedTransfer(false)
    .put()
    .uri(uri(pathSegments))
    .response()
    .doOnNext(applyResponseCallback())
    .map(ReactorNettyClient::toHttpResponse);
}

代码示例来源:origin: rabbitmq/hop

private Mono<HttpResponse> doPut(String... pathSegments) {
  return client.headersWhen(authorizedHeader())
    .headers(JSON_HEADER)
    .chunkedTransfer(false)
    .put()
    .uri(uri(pathSegments))
    .response()
    .doOnNext(applyResponseCallback())
    .map(ReactorNettyClient::toHttpResponse);
}

代码示例来源:origin: rabbitmq/hop

private Mono<HttpResponse> doPut(Object body, String... pathSegments) {
  return client.headersWhen(authorizedHeader())
    .chunkedTransfer(false)
    .put()
    .uri(uri(pathSegments))
    .send(bodyPublisher(body))
    .response()
    .doOnNext(applyResponseCallback())
    .map(ReactorNettyClient::toHttpResponse);
}

代码示例来源:origin: com.rabbitmq/http-client

private Mono<HttpResponse> doPut(Object body, String... pathSegments) {
  return client.headersWhen(authorizedHeader())
    .chunkedTransfer(false)
    .put()
    .uri(uri(pathSegments))
    .send(bodyPublisher(body))
    .response()
    .doOnNext(applyResponseCallback())
    .map(ReactorNettyClient::toHttpResponse);
}

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

@Test
@Ignore
public void postUpload() {
  InputStream f = getClass().getResourceAsStream("/public/index.html");
  HttpClient client =
      HttpClient.create()
           .tcpConfiguration(tcpClient -> tcpClient.host("google.com"))
           .wiretap(true);
  client.put()
     .uri("/post")
     .sendForm((req, form) -> form.multipart(true)
                    .file("test", f)
                    .attr("att1", "attr2")
                    .file("test2", f))
     .responseSingle((r, buf) -> Mono.just(r.status().code()))
     .block(Duration.ofSeconds(30));
  Integer res = client.followRedirect(true)
            .get()
            .uri("/search")
            .responseSingle((r, out) -> Mono.just(r.status().code()))
            .log()
            .block(Duration.ofSeconds(30));
  assertThat(res).isNotNull();
  if (res != 200) {
    throw new IllegalStateException("test status failed with " + res);
  }
}

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

.doOnResponse((r, c) -> System.out.println("onResp: "+r))
.doAfterResponse((r, c) -> System.out.println("afterResp: "+r))
.put()
.uri("/201")
.responseContent()
.doOnResponse((r, c) -> System.out.println("onResp: "+r))
.doAfterResponse((r, c) -> System.out.println("afterResp: "+r))
.put()
.uri("/204")
.responseContent()

相关文章