public abstract class ExchangeFilterFunctions extends Object
ExchangeFilterFunction
that provide various useful request filter
operations, such as basic authentication, error handling, etc.Constructor and Description |
---|
ExchangeFilterFunctions() |
Modifier and Type | Method and Description |
---|---|
static ExchangeFilterFunction |
basicAuthentication(String username,
String password)
Return a filter that adds an Authorization header for HTTP Basic Authentication.
|
static ExchangeFilterFunction |
clientError()
Return a filter that will publish a
WebClientException when the
ClientResponse has a 4xx status code. |
static ExchangeFilterFunction |
clientOrServerError()
Return a filter that will publish a
WebClientException if the
ClientResponse has a 4xx or 5xx status code. |
static ExchangeFilterFunction |
errorMapper(Function<ClientResponse,Optional<? extends Throwable>> mapper)
Return a filter that maps the response to a potential error.
|
static ExchangeFilterFunction |
errorPredicate(Predicate<ClientResponse> predicate)
Return a filter that will publish a
WebClientException if the response satisfies
the given predicate function. |
static ExchangeFilterFunction |
serverError()
Return a filter that will publish a
WebClientException if the
ClientResponse has a 5xx status code. |
public static ExchangeFilterFunction clientError()
WebClientException
when the
ClientResponse
has a 4xx status code.ExchangeFilterFunction
that publishes a WebClientException
when
the response has a client errorpublic static ExchangeFilterFunction serverError()
WebClientException
if the
ClientResponse
has a 5xx status code.ExchangeFilterFunction
that publishes a WebClientException
when
the response has a server errorpublic static ExchangeFilterFunction clientOrServerError()
WebClientException
if the
ClientResponse
has a 4xx or 5xx status code.ExchangeFilterFunction
that publishes a WebClientException
when
the response has a client or server errorpublic static ExchangeFilterFunction errorPredicate(Predicate<ClientResponse> predicate)
WebClientException
if the response satisfies
the given predicate
function.predicate
- the predicate to test the response withExchangeFilterFunction
that publishes a WebClientException
when
predicate
returns true
public static ExchangeFilterFunction errorMapper(Function<ClientResponse,Optional<? extends Throwable>> mapper)
mapper
will be published as signal in the Mono<ClientResponse>
return value.mapper
- the function that maps from response to optional errorExchangeFilterFunction
that propagates the errors provided by
mapper
public static ExchangeFilterFunction basicAuthentication(String username, String password)
username
- the username to usepassword
- the password to useExchangeFilterFunction
that adds the Authorization header