类 ExchangeFilterFunctions
- java.lang.Object
- org.springframework.web.reactive.function.client.ExchangeFilterFunctions
public abstract class ExchangeFilterFunctions extends Object
Static factory methods providing access to built-in implementations ofExchangeFilterFunction
for basic authentication, error handling, etc.- 从以下版本开始:
- 5.0
- 作者:
- Rob Winch, Arjen Poutsma, Sam Brannen
嵌套类概要
嵌套类 修饰符和类型 类 说明 static class
ExchangeFilterFunctions.Credentials
已过时。as of Spring 5.1 in favor of usingHttpHeaders.setBasicAuth(String, String)
while building the request.
字段概要
字段 修饰符和类型 字段 说明 static String
BASIC_AUTHENTICATION_CREDENTIALS_ATTRIBUTE
已过时。as of Spring 5.1 in favor of usingHttpHeaders.setBasicAuth(String, String)
while building the request.
构造器概要
构造器 构造器 说明 ExchangeFilterFunctions()
方法概要
所有方法 静态方法 具体方法 已过时的方法 修饰符和类型 方法 说明 static ExchangeFilterFunction
basicAuthentication()
已过时。as of Spring 5.1 in favor of usingHttpHeaders.setBasicAuth(String, String)
while building the request.static ExchangeFilterFunction
basicAuthentication(String username, String password)
Return a filter that applies HTTP Basic Authentication to the request headers viaHttpHeaders.setBasicAuth(String)
andHttpHeaders.encodeBasicAuth(String, String, Charset)
.static ExchangeFilterFunction
limitResponseSize(long maxByteCount)
Consume up to the specified number of bytes from the response body and cancel if any more data arrives.static ExchangeFilterFunction
statusError(Predicate<HttpStatus> statusPredicate, Function<ClientResponse,? extends Throwable> exceptionFunction)
Return a filter that generates an error signal when the givenHttpStatus
predicate matches.
字段详细资料
BASIC_AUTHENTICATION_CREDENTIALS_ATTRIBUTE
@Deprecated public static final String BASIC_AUTHENTICATION_CREDENTIALS_ATTRIBUTE
已过时。as of Spring 5.1 in favor of usingHttpHeaders.setBasicAuth(String, String)
while building the request.Name of the request attribute withExchangeFilterFunctions.Credentials
forbasicAuthentication()
.
构造器详细资料
ExchangeFilterFunctions
public ExchangeFilterFunctions()
方法详细资料
limitResponseSize
public static ExchangeFilterFunction limitResponseSize(long maxByteCount)
Consume up to the specified number of bytes from the response body and cancel if any more data arrives.Internally delegates to
DataBufferUtils.takeUntilByteCount(org.reactivestreams.Publisher<? extends org.springframework.core.io.buffer.DataBuffer>, long)
.- 参数:
maxByteCount
- the limit as number of bytes- 返回:
- the filter to limit the response size with
- 从以下版本开始:
- 5.1
statusError
public static ExchangeFilterFunction statusError(Predicate<HttpStatus> statusPredicate, Function<ClientResponse,? extends Throwable> exceptionFunction)
Return a filter that generates an error signal when the givenHttpStatus
predicate matches.- 参数:
statusPredicate
- the predicate to check the HTTP status withexceptionFunction
- the function that to create the exception- 返回:
- the filter to generate an error signal
basicAuthentication
public static ExchangeFilterFunction basicAuthentication(String username, String password)
Return a filter that applies HTTP Basic Authentication to the request headers viaHttpHeaders.setBasicAuth(String)
andHttpHeaders.encodeBasicAuth(String, String, Charset)
.- 参数:
username
- the usernamepassword
- the password- 返回:
- the filter to add authentication headers with
- 另请参阅:
HttpHeaders.encodeBasicAuth(String, String, Charset)
,HttpHeaders.setBasicAuth(String)
basicAuthentication
@Deprecated public static ExchangeFilterFunction basicAuthentication()
已过时。as of Spring 5.1 in favor of usingHttpHeaders.setBasicAuth(String, String)
while building the request.Variant ofbasicAuthentication(String, String)
that looks up theCredentials
in arequest attribute
.- 返回:
- the filter to use
- 另请参阅:
ExchangeFilterFunctions.Credentials