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 SummaryConstructorsConstructorDescriptionDefault constructor that creates and starts a new instance ofCloseableHttpAsyncClient.Constructor with a pre-configuredCloseableHttpAsyncClientinstance.HttpComponentsClientHttpConnector(CloseableHttpAsyncClient client, BiFunction<HttpMethod, URI, ? extends HttpClientContext> contextProvider) Constructor with a pre-configuredCloseableHttpAsyncClientinstance and aHttpClientContextsupplier lambda which is called before each request and passed to the client.
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()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 givenHttpMethodandURIand apply the givenrequestCallbackwhen the HTTP request of the underlying API can be initialized and written to.voidsetBufferFactory(DataBufferFactory bufferFactory) Set the buffer factory to use.
- 
Constructor Details- 
HttpComponentsClientHttpConnectorpublic HttpComponentsClientHttpConnector()Default constructor that creates and starts a new instance ofCloseableHttpAsyncClient.
- 
HttpComponentsClientHttpConnectorConstructor with a pre-configuredCloseableHttpAsyncClientinstance.- Parameters:
- client- the client to use
 
- 
HttpComponentsClientHttpConnectorpublic HttpComponentsClientHttpConnector(CloseableHttpAsyncClient client, BiFunction<HttpMethod, URI, ? extends HttpClientContext> contextProvider) Constructor with a pre-configuredCloseableHttpAsyncClientinstance and aHttpClientContextsupplier lambda which is called before each request and passed to the client.- Parameters:
- client- the client to use
- contextProvider- a- HttpClientContextsupplier
 
 
- 
- 
Method Details- 
setBufferFactorySet the buffer factory to use.
- 
connectpublic reactor.core.publisher.Mono<ClientHttpResponse> connect(HttpMethod method, URI uri, Function<? super ClientHttpRequest, reactor.core.publisher.Mono<Void>> requestCallback) Description copied from interface:ClientHttpConnectorConnect to the origin server using the givenHttpMethodandURIand apply the givenrequestCallbackwhen the HTTP request of the underlying API can be initialized and written to.- Specified by:
- connectin 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(org.reactivestreams.Publisher<? extends org.springframework.core.io.buffer.DataBuffer>)or- ReactiveHttpOutputMessage.setComplete().
- Returns:
- publisher for the ClientHttpResponse
 
- 
close- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Throws:
- IOException
 
 
-