Browse Source

Apply abortOnCancel in JettyClientHttpConnector

This new option allows a cancel signal to abort the request, which is
how we expect a connection to be aborted in a reactive chain that
involves the WebClient.

Closes gh-26287
pull/1283/head
Rossen Stoyanchev 4 years ago
parent
commit
0cf5005a3d
  1. 2
      spring-web/src/main/java/org/springframework/http/client/reactive/JettyClientHttpConnector.java

2
spring-web/src/main/java/org/springframework/http/client/reactive/JettyClientHttpConnector.java

@ -123,7 +123,7 @@ public class JettyClientHttpConnector implements ClientHttpConnector { @@ -123,7 +123,7 @@ public class JettyClientHttpConnector implements ClientHttpConnector {
Request request = this.httpClient.newRequest(uri).method(method.toString());
return requestCallback.apply(new JettyClientHttpRequest(request, this.bufferFactory))
.then(Mono.fromDirect(ReactiveRequest.newBuilder(request).build()
.then(Mono.fromDirect(ReactiveRequest.newBuilder(request).abortOnCancel(true).build()
.response((reactiveResponse, chunkPublisher) -> {
Flux<DataBuffer> content = Flux.from(chunkPublisher).map(this::toDataBuffer);
return Mono.just(new JettyClientHttpResponse(reactiveResponse, content));

Loading…
Cancel
Save