spring-framework / org.springframework.web.reactive.function.client / ExchangeFilterFunctions

ExchangeFilterFunctions

abstract class ExchangeFilterFunctions

Implementations of ExchangeFilterFunction that provide various useful request filter operations, such as basic authentication, error handling, etc.

Author
Rob Winch

Author
Arjen Poutsma

Since
5.0

Constructors

<init>

ExchangeFilterFunctions()

Implementations of ExchangeFilterFunction that provide various useful request filter operations, such as basic authentication, error handling, etc.

Properties

BASIC_AUTHENTICATION_CREDENTIALS_ATTRIBUTE

static val BASIC_AUTHENTICATION_CREDENTIALS_ATTRIBUTE: String

Name of the ClientRequest attribute that contains the Credentials, as used by #basicAuthentication().

Functions

basicAuthentication

open static fun basicAuthentication(username: String, password: String): ExchangeFilterFunction

Return a filter that adds an Authorization header for HTTP Basic Authentication, based on the given username and password.

Note that Basic Authentication only supports characters in the ISO-8859-1 character set.

open static fun basicAuthentication(): ExchangeFilterFunction

Return a filter that adds an Authorization header for HTTP Basic Authentication, based on the Credentials provided in the request attributes. If the attribute is not found, no authorization header is added.

Note that Basic Authentication only supports characters in the ISO-8859-1 character set.

statusError

open static fun statusError(statusPredicate: Predicate<HttpStatus>, exceptionFunction: Function<ClientResponse, out Throwable>): ExchangeFilterFunction

Return a filter that returns a given Throwable as response if the given HttpStatus predicate matches.