接口 WebClientTemplate
- 所有已知实现类:
AbstractWebClientTemplate
public interface WebClientTemplate
Description: WebClient 请求发送通用方法
- 作者:
- : gengwei.zheng
- Date:
- : 2024/5/4 21:50
-
方法概要
修饰符和类型方法说明default <O extends Response>
reactor.core.publisher.Mono<O> base(org.springframework.http.HttpMethod httpMethod, String endpoint, Map<String, Object> pathVariables, Map<String, Object> queryParams) GET 和 DELETE 请求,支持同时使用 pathVariables 和 queryParams 两种参数default <O extends Response>
reactor.core.publisher.Mono<O> 无参数的 DELETE 请求default <O extends Response>
reactor.core.publisher.Mono<O> QueryParams 类型参数的 DELETE 请求default <O extends Response>
reactor.core.publisher.Mono<O> DELETE 请求,支持同时使用 pathVariables 和 pathVariables 两种参数default <O extends Response>
reactor.core.publisher.Mono<O> deleteWithFormUrlEncoded(String endpoint, String key, String value) ContentType 为 "application/x-www-form-urlencoded" 类型的 DELETE 请求封装,default <O extends Response>
reactor.core.publisher.Mono<O> deleteWithFormUrlEncoded(String endpoint, Map<String, Object> formVariables) ContentType 为 "application/x-www-form-urlencoded" 类型的 DELETE 请求封装,default <O extends Response>
reactor.core.publisher.Mono<O> deleteWithFormUrlEncoded(String endpoint, Map<String, Object> formVariables, Map<String, Object> pathVariables) ContentType 为 "application/x-www-form-urlencoded" 类型的 DELETE 请求封装,default <O extends Response>
reactor.core.publisher.Mono<O> deleteWithPathVariables(String endpoint, String key, String value) PathVariables 类型参数的 DELETE 请求default <O extends Response>
reactor.core.publisher.Mono<O> deleteWithPathVariables(String endpoint, Map<String, Object> pathVariables) PathVariables 类型参数的 DELETE 请求default <O extends Response>
reactor.core.publisher.Mono<O> formUrlEncoded(org.springframework.http.HttpMethod httpMethod, String endpoint, Map<String, Object> formVariables, Map<String, Object> pathVariables) ContentType 为 "application/x-www-form-urlencoded" 类型的 POST 和 PUT 请求封装,default <O extends Response>
reactor.core.publisher.Mono<O> 无参数的 GET 请求default <O extends Response>
reactor.core.publisher.Mono<O> QueryParams 类型参数的 GET 请求default <O extends Response>
reactor.core.publisher.Mono<O> QueryParams 类型参数的 GET 请求default <O extends Response>
reactor.core.publisher.Mono<O> GET 请求,支持同时使用 pathVariables 和 pathVariables 两种参数org.springframework.core.convert.converter.Converter<Map<String, Object>, org.springframework.util.MultiValueMap<String, String>> WebClient Map 参数转换器org.springframework.web.reactive.function.client.WebClient获取到 WebClientdefault <O extends Response>
reactor.core.publisher.Mono<O> getWithPathVariables(String endpoint, Map<String, Object> pathVariables) PathVariables 类型参数的 GET 请求default <I,O extends Response>
reactor.core.publisher.Mono<O> json(org.springframework.http.HttpMethod httpMethod, String endpoint, I body, Map<String, Object> pathVariables) ContentType 为 "application/json" 类型的 POST 和 PUT 请求封装,<O> Function<org.springframework.web.reactive.function.client.WebClientResponseException, reactor.core.publisher.Mono<O>> WebClient 错误处理。default <I,O extends Response>
reactor.core.publisher.Mono<O> ContentType 为 "application/json" 类型的 POST 请求封装,default <I,O extends Response>
reactor.core.publisher.Mono<O> ContentType 为 "application/json" 类型的 POST 请求封装,default <O extends Response>
reactor.core.publisher.Mono<O> postWithFormUrlEncoded(String endpoint, Map<String, Object> formVariables) ContentType 为 "application/x-www-form-urlencoded" 类型的 POST 请求封装,default <O extends Response>
reactor.core.publisher.Mono<O> postWithFormUrlEncoded(String endpoint, Map<String, Object> formVariables, Map<String, Object> pathVariables) ContentType 为 "application/x-www-form-urlencoded" 类型的 POST 请求封装,default <I,O extends Response>
reactor.core.publisher.Mono<O> ContentType 为 "application/json" 类型的 PUT 请求封装,default <I,O extends Response>
reactor.core.publisher.Mono<O> ContentType 为 "application/json" 类型的 PUT 请求封装,default <O extends Response>
reactor.core.publisher.Mono<O> putWithFormUrlEncoded(String endpoint, Map<String, Object> formVariables) ContentType 为 "application/x-www-form-urlencoded" 类型的 PUT 请求封装,default <O extends Response>
reactor.core.publisher.Mono<O> putWithFormUrlEncoded(String endpoint, Map<String, Object> formVariables, Map<String, Object> pathVariables) ContentType 为 "application/x-www-form-urlencoded" 类型的 PUT 请求封装,default <I,O extends Response>
reactor.core.publisher.Mono<O> request(org.springframework.http.HttpMethod httpMethod, String endpoint, I body, Map<String, Object> formVariables, Map<String, Object> pathVariables, Map<String, Object> queryParams, Function<org.springframework.web.reactive.function.client.WebClientResponseException, reactor.core.publisher.Mono<O>> onErrorResume) WebClient 请求通用操作
-
方法详细资料
-
getMultiValueMapConverter
org.springframework.core.convert.converter.Converter<Map<String,Object>, getMultiValueMapConverter()org.springframework.util.MultiValueMap<String, String>> WebClient Map 参数转换器- 返回:
- 转换器
Converter
-
getWebClient
org.springframework.web.reactive.function.client.WebClient getWebClient()获取到 WebClient- 返回:
WebClient
-
onErrorResume
<O> Function<org.springframework.web.reactive.function.client.WebClientResponseException,reactor.core.publisher.Mono<O>> onErrorResume()WebClient 错误处理。主要解决WebClientResponseException转换成统一的响应实体- 类型参数:
O- 响应数据类型- 返回:
Function
-
request
default <I,O extends Response> reactor.core.publisher.Mono<O> request(org.springframework.http.HttpMethod httpMethod, String endpoint, I body, Map<String, Object> formVariables, Map<String, Object> pathVariables, Map<String, Object> queryParams, Function<org.springframework.web.reactive.function.client.WebClientResponseException, reactor.core.publisher.Mono<O>> onErrorResume) WebClient 请求通用操作- 类型参数:
I- 请求数据类型,用于 ContentType 为 "application/json" 类型请求O- 响应数据类型- 参数:
httpMethod- 请求类型HttpMethodendpoint- 请求 APIbody- 请求体数据对象,任意类型对象,用于 ContentType 为 "application/json" 类型请求formVariables- 请求体数据Map,用于 ContentType 为 "application/x-www-form-urlencoded" 请求pathVariables- pathVariables 类型请求路径参数 例如:/xxx/{id};queryParams- queryParams 类型请求路径上的参数 例如:/xxx?id=xxxonErrorResume- WebClient 调用 API 出错错误处理- 返回:
- 自定义响应结果。如果出错,则结果内容为错误信息
-
base
default <O extends Response> reactor.core.publisher.Mono<O> base(org.springframework.http.HttpMethod httpMethod, String endpoint, Map<String, Object> pathVariables, Map<String, Object> queryParams) GET 和 DELETE 请求,支持同时使用 pathVariables 和 queryParams 两种参数- 类型参数:
O- 响应数据类型- 参数:
httpMethod- 请求类型HttpMethodendpoint- 请求 APIpathVariables- pathVariables 类型请求路径参数 例如:/xxx/{id};queryParams- queryParams 类型请求路径上的参数 例如:/xxx?id=xxx- 返回:
- 自定义响应结果。如果出错,则结果内容为错误信息
-
json
default <I,O extends Response> reactor.core.publisher.Mono<O> json(org.springframework.http.HttpMethod httpMethod, String endpoint, I body, Map<String, Object> pathVariables) ContentType 为 "application/json" 类型的 POST 和 PUT 请求封装,- 类型参数:
I- 请求数据类型,用于 ContentType 为 "application/json" 类型请求O- 响应数据类型- 参数:
httpMethod- 请求类型HttpMethodendpoint- 请求 APIbody- 请求体数据对象pathVariables- pathVariables 类型请求路径参数- 返回:
- 自定义响应结果。如果出错,则结果内容为错误信息
-
formUrlEncoded
default <O extends Response> reactor.core.publisher.Mono<O> formUrlEncoded(org.springframework.http.HttpMethod httpMethod, String endpoint, Map<String, Object> formVariables, Map<String, Object> pathVariables) ContentType 为 "application/x-www-form-urlencoded" 类型的 POST 和 PUT 请求封装,- 类型参数:
O- 响应数据类型- 参数:
httpMethod- 请求类型HttpMethodendpoint- 请求 APIformVariables- 请求体数据MappathVariables- pathVariables 类型请求路径参数- 返回:
- 自定义响应结果。如果出错,则结果内容为错误信息
-
get
default <O extends Response> reactor.core.publisher.Mono<O> get(String endpoint, Map<String, Object> pathVariables, Map<String, Object> queryParams) GET 请求,支持同时使用 pathVariables 和 pathVariables 两种参数- 类型参数:
O- 响应数据类型- 参数:
endpoint- 请求 APIpathVariables- pathVariables 类型请求路径参数 例如:/xxx/{id};queryParams- queryParams 类型请求路径上的参数 例如:/xxx?id=xxx- 返回:
- 自定义响应结果。如果出错,则结果内容为错误信息
-
get
default <O extends Response> reactor.core.publisher.Mono<O> get(String endpoint, Map<String, Object> queryParams) QueryParams 类型参数的 GET 请求- 类型参数:
O- 响应数据类型- 参数:
endpoint- 请求 APIqueryParams- queryParams 类型请求路径上的参数 例如:/xxx?id=xxx- 返回:
- 自定义响应结果。如果出错,则结果内容为错误信息
-
get
default <O extends Response> reactor.core.publisher.Mono<O> get(String endpoint, String key, String value) QueryParams 类型参数的 GET 请求- 类型参数:
O- 响应数据类型- 参数:
endpoint- 请求 APIkey- 请求参数名value- 请求参数值- 返回:
- 自定义响应结果。如果出错,则结果内容为错误信息
-
get
无参数的 GET 请求- 类型参数:
O- 响应数据类型- 参数:
endpoint- 请求 API- 返回:
- 自定义响应结果。如果出错,则结果内容为错误信息
-
getWithPathVariables
default <O extends Response> reactor.core.publisher.Mono<O> getWithPathVariables(String endpoint, Map<String, Object> pathVariables) PathVariables 类型参数的 GET 请求- 类型参数:
O- 响应数据类型- 参数:
endpoint- 请求 APIpathVariables- pathVariables 类型请求路径参数 例如:/xxx/{id};- 返回:
- 自定义响应结果。如果出错,则结果内容为错误信息
-
delete
default <O extends Response> reactor.core.publisher.Mono<O> delete(String endpoint, Map<String, Object> pathVariables, Map<String, Object> queryParams) DELETE 请求,支持同时使用 pathVariables 和 pathVariables 两种参数- 类型参数:
O- 响应数据类型- 参数:
endpoint- 请求 APIpathVariables- pathVariables 类型请求路径参数 例如:/xxx/{id};queryParams- queryParams 类型请求路径上的参数 例如:/xxx?id=xxx- 返回:
- 自定义响应结果。如果出错,则结果内容为错误信息
-
delete
default <O extends Response> reactor.core.publisher.Mono<O> delete(String endpoint, Map<String, Object> queryParams) QueryParams 类型参数的 DELETE 请求- 类型参数:
O- 响应数据类型- 参数:
endpoint- 请求 APIqueryParams- queryParams 类型请求路径上的参数 例如:/xxx?id=xxx- 返回:
- 自定义响应结果。如果出错,则结果内容为错误信息
-
delete
无参数的 DELETE 请求- 类型参数:
O- 响应数据类型- 参数:
endpoint- 请求 API- 返回:
- 自定义响应结果。如果出错,则结果内容为错误信息
-
deleteWithPathVariables
default <O extends Response> reactor.core.publisher.Mono<O> deleteWithPathVariables(String endpoint, Map<String, Object> pathVariables) PathVariables 类型参数的 DELETE 请求- 类型参数:
O- 响应数据类型- 参数:
endpoint- 请求 APIpathVariables- pathVariables 类型请求路径参数 例如:/xxx/{id};- 返回:
- 自定义响应结果。如果出错,则结果内容为错误信息
-
deleteWithPathVariables
default <O extends Response> reactor.core.publisher.Mono<O> deleteWithPathVariables(String endpoint, String key, String value) PathVariables 类型参数的 DELETE 请求- 类型参数:
O- 响应数据类型- 参数:
endpoint- 请求 APIkey- 请求参数名value- 请求参数值- 返回:
- 自定义响应结果。如果出错,则结果内容为错误信息
-
deleteWithFormUrlEncoded
default <O extends Response> reactor.core.publisher.Mono<O> deleteWithFormUrlEncoded(String endpoint, Map<String, Object> formVariables, Map<String, Object> pathVariables) ContentType 为 "application/x-www-form-urlencoded" 类型的 DELETE 请求封装,- 类型参数:
O- 响应数据类型- 参数:
endpoint- 请求 APIformVariables- 请求体数据MappathVariables- pathVariables 类型请求路径参数- 返回:
- 自定义响应结果。如果出错,则结果内容为错误信息
-
deleteWithFormUrlEncoded
default <O extends Response> reactor.core.publisher.Mono<O> deleteWithFormUrlEncoded(String endpoint, Map<String, Object> formVariables) ContentType 为 "application/x-www-form-urlencoded" 类型的 DELETE 请求封装,- 类型参数:
O- 响应数据类型- 参数:
endpoint- 请求 APIformVariables- 请求体数据Map- 返回:
- 自定义响应结果。如果出错,则结果内容为错误信息
-
deleteWithFormUrlEncoded
default <O extends Response> reactor.core.publisher.Mono<O> deleteWithFormUrlEncoded(String endpoint, String key, String value) ContentType 为 "application/x-www-form-urlencoded" 类型的 DELETE 请求封装,- 类型参数:
O- 响应数据类型- 参数:
endpoint- 请求 APIkey- 请求参数名value- 请求参数值- 返回:
- 自定义响应结果。如果出错,则结果内容为错误信息
-
post
default <I,O extends Response> reactor.core.publisher.Mono<O> post(String endpoint, I body, Map<String, Object> pathVariables) ContentType 为 "application/json" 类型的 POST 请求封装,- 类型参数:
I- 请求数据类型,用于 ContentType 为 "application/json" 类型请求O- 响应数据类型- 参数:
endpoint- 请求 APIbody- 请求体数据对象pathVariables- pathVariables 类型请求路径参数- 返回:
- 自定义响应结果。如果出错,则结果内容为错误信息
-
post
ContentType 为 "application/json" 类型的 POST 请求封装,- 类型参数:
I- 请求数据类型,用于 ContentType 为 "application/json" 类型请求O- 响应数据类型- 参数:
endpoint- 请求 APIbody- 请求体数据对象- 返回:
- 自定义响应结果。如果出错,则结果内容为错误信息
-
postWithFormUrlEncoded
default <O extends Response> reactor.core.publisher.Mono<O> postWithFormUrlEncoded(String endpoint, Map<String, Object> formVariables, Map<String, Object> pathVariables) ContentType 为 "application/x-www-form-urlencoded" 类型的 POST 请求封装,- 类型参数:
O- 响应数据类型- 参数:
endpoint- 请求 APIformVariables- 请求体数据MappathVariables- pathVariables 类型请求路径参数- 返回:
- 自定义响应结果。如果出错,则结果内容为错误信息
-
postWithFormUrlEncoded
default <O extends Response> reactor.core.publisher.Mono<O> postWithFormUrlEncoded(String endpoint, Map<String, Object> formVariables) ContentType 为 "application/x-www-form-urlencoded" 类型的 POST 请求封装,- 类型参数:
O- 响应数据类型- 参数:
endpoint- 请求 APIformVariables- 请求体数据Map- 返回:
- 自定义响应结果。如果出错,则结果内容为错误信息
-
put
default <I,O extends Response> reactor.core.publisher.Mono<O> put(String endpoint, I body, Map<String, Object> pathVariables) ContentType 为 "application/json" 类型的 PUT 请求封装,- 类型参数:
I- 请求数据类型,用于 ContentType 为 "application/json" 类型请求O- 响应数据类型- 参数:
endpoint- 请求 APIbody- 请求体数据对象pathVariables- pathVariables 类型请求路径参数- 返回:
- 自定义响应结果。如果出错,则结果内容为错误信息
-
put
ContentType 为 "application/json" 类型的 PUT 请求封装,- 类型参数:
I- 请求数据类型,用于 ContentType 为 "application/json" 类型请求O- 响应数据类型- 参数:
endpoint- 请求 APIbody- 请求体数据对象- 返回:
- 自定义响应结果。如果出错,则结果内容为错误信息
-
putWithFormUrlEncoded
default <O extends Response> reactor.core.publisher.Mono<O> putWithFormUrlEncoded(String endpoint, Map<String, Object> formVariables, Map<String, Object> pathVariables) ContentType 为 "application/x-www-form-urlencoded" 类型的 PUT 请求封装,- 类型参数:
O- 响应数据类型- 参数:
endpoint- 请求 APIformVariables- 请求体数据MappathVariables- pathVariables 类型请求路径参数- 返回:
- 自定义响应结果。如果出错,则结果内容为错误信息
-
putWithFormUrlEncoded
default <O extends Response> reactor.core.publisher.Mono<O> putWithFormUrlEncoded(String endpoint, Map<String, Object> formVariables) ContentType 为 "application/x-www-form-urlencoded" 类型的 PUT 请求封装,- 类型参数:
O- 响应数据类型- 参数:
endpoint- 请求 APIformVariables- 请求体数据Map- 返回:
- 自定义响应结果。如果出错,则结果内容为错误信息
-