Top Description Inners Fields Constructors Methods
org.springframework.web.reactive.function.client

public abstract Class ExchangeFunctions

extends Object
Class Inheritance
Imports
java.net.URI, org.apache.commons.logging.Log, .LogFactory, reactor.core.publisher.Mono, org.springframework.core.log.LogFormatUtils, org.springframework.http.HttpHeaders, .HttpMethod, .HttpRequest, org.springframework.http.client.reactive.ClientHttpConnector, .ClientHttpResponse, org.springframework.http.codec.LoggingCodecSupport, org.springframework.util.Assert

Static factory methods to create an ExchangeFunction.
Authors
Arjen Poutsma, Rossen Stoyanchev
Since
5.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static final Log

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static ExchangeFunction

Returns:

the created ExchangeFunction
create
(ClientHttpConnector
the connector to use for connecting to servers
connector
)

Create an ExchangeFunction with the given ClientHttpConnector.

public static ExchangeFunction

Returns:

the created ExchangeFunction
create
(ClientHttpConnector
the connector to use for connecting to servers
connector
,
ExchangeStrategies
the ExchangeStrategies to use
strategies
)

Create an ExchangeFunction with the given ClientHttpConnector and ExchangeStrategies.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

loggerback to summary
private static final Log logger

Constructor Detail

ExchangeFunctionsback to summary
public ExchangeFunctions()

Method Detail

createback to summary
public static ExchangeFunction create(ClientHttpConnector connector)

Create an ExchangeFunction with the given ClientHttpConnector. This is the same as calling create(ClientHttpConnector, ExchangeStrategies) and passing ExchangeStrategies#withDefaults().

Parameters
connector:ClientHttpConnector

the connector to use for connecting to servers

Returns:ExchangeFunction

the created ExchangeFunction

createback to summary
public static ExchangeFunction create(ClientHttpConnector connector, ExchangeStrategies strategies)

Create an ExchangeFunction with the given ClientHttpConnector and ExchangeStrategies.

Parameters
connector:ClientHttpConnector

the connector to use for connecting to servers

strategies:ExchangeStrategies

the ExchangeStrategies to use

Returns:ExchangeFunction

the created ExchangeFunction

org.springframework.web.reactive.function.client back to summary

private Class ExchangeFunctions.DefaultExchangeFunction

extends Object
implements ExchangeFunction
Class Inheritance
  • java.lang.Object
  • org.springframework.web.reactive.function.client.ExchangeFunctions.DefaultExchangeFunction
All Implemented Interfaces
org.springframework.web.reactive.function.client.ExchangeFunction

Field Summary

Modifier and TypeField and Description
private final ClientHttpConnector
private boolean
private final ExchangeStrategies

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private HttpRequest
public Mono<ClientResponse>
exchange(ClientRequest
the request to exchange
clientRequest
)

Implements org.springframework.web.reactive.function.client.ExchangeFunction.exchange.

Exchange the given request for a ClientResponse promise.

private String
private String
private void
private void
logResponse(ClientHttpResponse response, String logPrefix)

private <T> Mono<T>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

connectorback to summary
private final ClientHttpConnector connector
enableLoggingRequestDetailsback to summary
private boolean enableLoggingRequestDetails
strategiesback to summary
private final ExchangeStrategies strategies

Constructor Detail

DefaultExchangeFunctionback to summary
public DefaultExchangeFunction(ClientHttpConnector connector, ExchangeStrategies strategies)

Method Detail

createRequestback to summary
private HttpRequest createRequest(ClientRequest request)
exchangeback to summary
public Mono<ClientResponse> exchange(ClientRequest clientRequest)

Implements org.springframework.web.reactive.function.client.ExchangeFunction.exchange.

Doc from org.springframework.web.reactive.function.client.ExchangeFunction.exchange.

Exchange the given request for a ClientResponse promise.

Note

When calling this method from an ExchangeFilterFunction that handles the response in some way, extra care must be taken to always consume its content or otherwise propagate it downstream for further handling, for example by the WebClient. Please see the reference documentation for more details on this.

Parameters
clientRequest:ClientRequest

the request to exchange

Returns:Mono<ClientResponse>

the delayed response

Annotations
@Override
formatHeadersback to summary
private String formatHeaders(HttpHeaders headers)
getLogPrefixback to summary
private String getLogPrefix(ClientRequest request, ClientHttpResponse response)
logRequestback to summary
private void logRequest(ClientRequest request)
logResponseback to summary
private void logResponse(ClientHttpResponse response, String logPrefix)
wrapExceptionback to summary
private <T> Mono<T> wrapException(Throwable t, ClientRequest r)