Class JettyClientHttpConnector
java.lang.Object
org.springframework.http.client.reactive.JettyClientHttpConnector
- All Implemented Interfaces:
ClientHttpConnector
ClientHttpConnector
for the Jetty Reactive Streams HttpClient.- Since:
- 5.1
- Author:
- Sebastien Deleuze
- See Also:
-
Constructor Summary
ConstructorDescriptionDefault constructor that creates a new instance ofHttpClient
.JettyClientHttpConnector
(org.eclipse.jetty.client.HttpClient httpClient) Constructor with an initializedHttpClient
.JettyClientHttpConnector
(org.eclipse.jetty.client.HttpClient httpClient, JettyResourceFactory resourceFactory) Constructor with an initializedHttpClient
and configures it with the givenJettyResourceFactory
.JettyClientHttpConnector
(JettyResourceFactory resourceFactory, Consumer<org.eclipse.jetty.client.HttpClient> customizer) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionreactor.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 givenHttpMethod
andURI
and apply the givenrequestCallback
when the HTTP request of the underlying API can be initialized and written to.void
setBufferFactory
(DataBufferFactory bufferFactory) Set the buffer factory to use.
-
Constructor Details
-
JettyClientHttpConnector
public JettyClientHttpConnector()Default constructor that creates a new instance ofHttpClient
. -
JettyClientHttpConnector
public JettyClientHttpConnector(org.eclipse.jetty.client.HttpClient httpClient) Constructor with an initializedHttpClient
. -
JettyClientHttpConnector
public JettyClientHttpConnector(org.eclipse.jetty.client.HttpClient httpClient, @Nullable JettyResourceFactory resourceFactory) Constructor with an initializedHttpClient
and configures it with the givenJettyResourceFactory
.- Parameters:
httpClient
- theHttpClient
to useresourceFactory
- theJettyResourceFactory
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 ofJettyClientHttpConnector(HttpClient, JettyResourceFactory)
Constructor with anJettyResourceFactory
that will manage shared resources.- Parameters:
resourceFactory
- theJettyResourceFactory
to usecustomizer
- the lambda used to customize theHttpClient
-
-
Method Details
-
setBufferFactory
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 givenHttpMethod
andURI
and apply the givenrequestCallback
when the HTTP request of the underlying API can be initialized and written to.- Specified by:
connect
in interfaceClientHttpConnector
- Parameters:
method
- the HTTP request methoduri
- the HTTP request URIrequestCallback
- a function that prepares and writes to the request, returning a publisher that signals when it's done writing. Implementations can return aMono<Void>
by callingReactiveHttpOutputMessage.writeWith(org.reactivestreams.Publisher<? extends org.springframework.core.io.buffer.DataBuffer>)
orReactiveHttpOutputMessage.setComplete()
.- Returns:
- publisher for the
ClientHttpResponse
-
JettyClientHttpConnector(HttpClient, JettyResourceFactory)