Class HttpComponentsClientHttpConnector

java.lang.Object
org.springframework.http.client.reactive.HttpComponentsClientHttpConnector
All Implemented Interfaces:
Closeable, AutoCloseable, ClientHttpConnector

public class HttpComponentsClientHttpConnector extends Object implements ClientHttpConnector, Closeable
ClientHttpConnector implementation for the Apache HttpComponents HttpClient 5.x.
Since:
5.3
Author:
Martin Tarjányi, Arjen Poutsma
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor that creates and starts a new instance of CloseableHttpAsyncClient.
    HttpComponentsClientHttpConnector(org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient client)
    Constructor with a pre-configured CloseableHttpAsyncClient instance.
    HttpComponentsClientHttpConnector(org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient client, BiFunction<HttpMethod,URI,? extends org.apache.hc.client5.http.protocol.HttpClientContext> contextProvider)
    Constructor with a pre-configured CloseableHttpAsyncClient instance and a HttpClientContext supplier lambda which is called before each request and passed to the client.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    reactor.core.publisher.Mono<ClientHttpResponse>
    connect(HttpMethod method, URI uri, Function<? super ClientHttpRequest,reactor.core.publisher.Mono<Void>> requestCallback)
    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.
    void
    setBufferFactory(org.springframework.core.io.buffer.DataBufferFactory bufferFactory)
    Set the buffer factory to use.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • HttpComponentsClientHttpConnector

      public HttpComponentsClientHttpConnector()
      Default constructor that creates and starts a new instance of CloseableHttpAsyncClient.
    • HttpComponentsClientHttpConnector

      public HttpComponentsClientHttpConnector(org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient client)
      Constructor with a pre-configured CloseableHttpAsyncClient instance.
      Parameters:
      client - the client to use
    • HttpComponentsClientHttpConnector

      public HttpComponentsClientHttpConnector(org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient client, BiFunction<HttpMethod,URI,? extends org.apache.hc.client5.http.protocol.HttpClientContext> contextProvider)
      Constructor with a pre-configured CloseableHttpAsyncClient instance and a HttpClientContext supplier lambda which is called before each request and passed to the client.
      Parameters:
      client - the client to use
      contextProvider - a HttpClientContext supplier
  • Method Details