Package org.springframework.http.client.reactive

# Class ReactorNetty2ClientHttpConnector

java.lang.Object
org.springframework.http.client.reactive.ReactorNetty2ClientHttpConnector

All Implemented Interfaces:
  `ClientHttpConnector`

@Deprecated(since="6.2.18", forRemoval=true) public class ReactorNetty2ClientHttpConnector extends Object implements ClientHttpConnector
Deprecated, for removal: This API element is subject to removal in a future version.
as of 6.2.18 with no replacement
Reactor Netty 2 (Netty 5) implementation of `ClientHttpConnector`.

This class is based on `ReactorClientHttpConnector`.

Since:
  6.0
Author:
  Violeta Georgieva
See Also:
  - `HttpClient`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final io.netty5.util.AttributeKey<Map<String,Object>>`
`ATTRIBUTES_KEY`
Deprecated, for removal: This API element is subject to removal in a future version.
Channel attribute key under which `WebClient` request attributes are stored as a Map.

## Constructor Summary

Constructors
Constructor
Description
`ReactorNetty2ClientHttpConnector()`
Deprecated, for removal: This API element is subject to removal in a future version.
Default constructor.
`ReactorNetty2ClientHttpConnector(ReactorNetty2ResourceFactory factory, Function<reactor.netty5.http.client.HttpClient,reactor.netty5.http.client.HttpClient> mapper)`
Deprecated, for removal: This API element is subject to removal in a future version.
Constructor with externally managed Reactor Netty resources, including `LoopResources` for event loop threads, and `ConnectionProvider` for the connection pool.
`ReactorNetty2ClientHttpConnector(reactor.netty5.http.client.HttpClient httpClient)`
Deprecated, for removal: This API element is subject to removal in a future version.
Constructor with a pre-configured `HttpClient` instance.

## Method Summary

Modifier and Type
Method
Description
`reactor.core.publisher.Mono<ClientHttpResponse>`
`connect(HttpMethod method, URI uri, Function<? super ClientHttpRequest,reactor.core.publisher.Mono<Void>> requestCallback)`
Deprecated, for removal: This API element is subject to removal in a future version.
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.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### ATTRIBUTES_KEY

public static final io.netty5.util.AttributeKey<Map<String,Object>> ATTRIBUTES_KEY
Deprecated, for removal: This API element is subject to removal in a future version.
Channel attribute key under which `WebClient` request attributes are stored as a Map.

Since:
  6.2

## Constructor Details

### ReactorNetty2ClientHttpConnector

public ReactorNetty2ClientHttpConnector()
Deprecated, for removal: This API element is subject to removal in a future version.
Default constructor. Initializes `HttpClient` via:

     HttpClient.create().compress()

### ReactorNetty2ClientHttpConnector

public ReactorNetty2ClientHttpConnector(ReactorNetty2ResourceFactory factory, Function<reactor.netty5.http.client.HttpClient,reactor.netty5.http.client.HttpClient> mapper)
Deprecated, for removal: This API element is subject to removal in a future version.
Constructor with externally managed Reactor Netty resources, including `LoopResources` for event loop threads, and `ConnectionProvider` for the connection pool.

This constructor should be used only when you don't want the client to participate in the Reactor Netty global resources. By default, the client participates in the Reactor Netty global resources held in `HttpResources`, which is recommended since fixed, shared resources are favored for event loop concurrency. However, consider declaring a `ReactorNetty2ResourceFactory` bean with `globalResources=true` in order to ensure the Reactor Netty global resources are shut down when the Spring ApplicationContext is closed.

Parameters:
  `factory` - the resource factory to obtain the resources from
  `mapper` - a mapper for further initialization of the created client
Since:
  5.1

### ReactorNetty2ClientHttpConnector

public ReactorNetty2ClientHttpConnector(reactor.netty5.http.client.HttpClient httpClient)
Deprecated, for removal: This API element is subject to removal in a future version.
Constructor with a pre-configured `HttpClient` instance.

Parameters:
  `httpClient` - the client to use
Since:
  5.1

## Method Details

### connect

public reactor.core.publisher.Mono<ClientHttpResponse> connect(HttpMethod method, URI uri, Function<? super ClientHttpRequest,reactor.core.publisher.Mono<Void>> requestCallback)
Deprecated, for removal: This API element is subject to removal in a future version.
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(org.reactivestreams.Publisher<? extends org.springframework.core.io.buffer.DataBuffer>)` or `ReactiveHttpOutputMessage.setComplete()`.
Returns:
  publisher for the `ClientHttpResponse`