Package org.springframework.http.client.reactive

# Class JettyClientHttpConnector

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

All Implemented Interfaces:
  `ClientHttpConnector`

public class JettyClientHttpConnector extends Object implements ClientHttpConnector
`ClientHttpConnector` for the Jetty Reactive Streams HttpClient.

Since:
  5.1
Author:
  Sebastien Deleuze
See Also:
  - Jetty ReactiveStreams HttpClient

## Constructor Summary

Constructors
Constructor
Description
`JettyClientHttpConnector()`
Default constructor that creates a new instance of `HttpClient`.
`JettyClientHttpConnector(org.eclipse.jetty.client.HttpClient httpClient)`
Constructor with an initialized `HttpClient`.
`JettyClientHttpConnector(org.eclipse.jetty.client.HttpClient httpClient, JettyResourceFactory resourceFactory)`
Constructor with an initialized `HttpClient` and configures it with the given `JettyResourceFactory`.
`JettyClientHttpConnector(JettyResourceFactory resourceFactory, Consumer<org.eclipse.jetty.client.HttpClient> customizer)`
Deprecated.
as of 5.2, in favor of `JettyClientHttpConnector(HttpClient, JettyResourceFactory)`

## 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)`
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.JettyDataBufferFactory 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

### JettyClientHttpConnector

public JettyClientHttpConnector()
Default constructor that creates a new instance of `HttpClient`.

### JettyClientHttpConnector

public JettyClientHttpConnector(org.eclipse.jetty.client.HttpClient httpClient)
Constructor with an initialized `HttpClient`.

### JettyClientHttpConnector

public JettyClientHttpConnector(org.eclipse.jetty.client.HttpClient httpClient, @Nullable JettyResourceFactory resourceFactory)
Constructor with an initialized `HttpClient` and configures it with the given `JettyResourceFactory`.

Parameters:
  `httpClient` - the `HttpClient` to use
  `resourceFactory` - the `JettyResourceFactory` to use
Since:
  5.2

### JettyClientHttpConnector

@Deprecated public JettyClientHttpConnector(JettyResourceFactory resourceFactory, @Nullable Consumer<org.eclipse.jetty.client.HttpClient> customizer)
Deprecated.
as of 5.2, in favor of `JettyClientHttpConnector(HttpClient, JettyResourceFactory)`
Constructor with an `JettyResourceFactory` that will manage shared resources.

Parameters:
  `resourceFactory` - the `JettyResourceFactory` to use
  `customizer` - the lambda used to customize the `HttpClient`

## Method Details

### setBufferFactory

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

### 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(org.reactivestreams.Publisher<? extends org.springframework.core.io.buffer.DataBuffer>)` or `ReactiveHttpOutputMessage.setComplete()`.
Returns:
  publisher for the `ClientHttpResponse`