Class JdkClientHttpConnector

java.lang.Object
org.springframework.http.client.reactive.JdkClientHttpConnector
All Implemented Interfaces:
ClientHttpConnector

public class JdkClientHttpConnector extends Object implements ClientHttpConnector
Since:
6.0
Author:
Julien Eyraud, Rossen Stoyanchev
See Also:
  • Constructor Details

  • Method Details

    • setBufferFactory

      public void setBufferFactory(org.springframework.core.io.buffer.DataBufferFactory bufferFactory)
      Set the buffer factory to use.

      By default, this is DefaultDataBufferFactory.sharedInstance.

    • setReadTimeout

      public void setReadTimeout(Duration readTimeout)
      Set the underlying HttpClient read timeout as a Duration.

      Default is the system's default timeout.

      Since:
      6.2
      See Also:
    • setCookieParser

      public void setCookieParser(ResponseCookie.Parser parser)
      Customize the parsing of response cookies.

      By default, HttpCookie.parse(String) is used, and additionally the sameSite attribute is parsed and set.

      Parameters:
      parser - the parser to use
      Since:
      7.0
    • connect

      public reactor.core.publisher.Mono<ClientHttpResponse> connect(HttpMethod method, URI uri, Function<? super ClientHttpRequest, reactor.core.publisher.Mono<Void>> requestCallback)
      Description copied from interface: ClientHttpConnector
      Connect to the origin server using the given HttpMethod and URI and apply the given requestCallback when the HTTP request of the underlying API can be initialized and written to.
      Specified by:
      connect in interface ClientHttpConnector
      Parameters:
      method - the HTTP request method
      uri - the HTTP request URI
      requestCallback - a function that prepares and writes to the request, returning a publisher that signals when it's done writing. Implementations can return a Mono<Void> by calling ReactiveHttpOutputMessage.writeWith(Publisher) or ReactiveHttpOutputMessage.setComplete().
      Returns:
      publisher for the ClientHttpResponse