Package cn.net.pap.task.webclient
Class WebClientUtil
java.lang.Object
cn.net.pap.task.webclient.WebClientUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidempty()static org.springframework.web.reactive.function.client.ClientResponseWebClient post body jsonstatic StringpostBodyObjectSimple(String url, Object objectJSON, org.springframework.http.HttpHeaders headers, Integer maxByteCount) simple http post request bodystatic booleanpostBodyObjectSimpleBlindly(String url, String bodyJSON, org.springframework.http.HttpHeaders headers) 极简异步 POST (JSON) - 盲发模式 (Fire-and-forget) 复用全局配置的 webClient (包含连接池、Cookie存储、拦截器等机制)static reactor.core.publisher.Mono<org.springframework.web.reactive.function.client.ClientResponse>异步POST请求 - 返回Mono,由调用方决定是否阻塞
-
Constructor Details
-
WebClientUtil
public WebClientUtil()
-
-
Method Details
-
postMono
public static reactor.core.publisher.Mono<org.springframework.web.reactive.function.client.ClientResponse> postMono(String url, String bodyJSON, org.springframework.http.HttpHeaders headers) 异步POST请求 - 返回Mono,由调用方决定是否阻塞 -
postBodyObjectSimple
public static String postBodyObjectSimple(String url, Object objectJSON, org.springframework.http.HttpHeaders headers, Integer maxByteCount) simple http post request body- Parameters:
url-objectJSON-headers-maxByteCount- 10*1024*1024代表10MB- Returns:
-
postBody
public static org.springframework.web.reactive.function.client.ClientResponse postBody(String url, String bodyJSON, org.springframework.http.HttpHeaders headers) WebClient post body json- Parameters:
url-bodyJSON-- Returns:
-
empty
public static void empty() -
postBodyObjectSimpleBlindly
public static boolean postBodyObjectSimpleBlindly(String url, String bodyJSON, org.springframework.http.HttpHeaders headers) 极简异步 POST (JSON) - 盲发模式 (Fire-and-forget) 复用全局配置的 webClient (包含连接池、Cookie存储、拦截器等机制)- Parameters:
url- 请求地址bodyJSON- 请求体 JSON 字符串headers- 额外的 HTTP 头 (可选,允许为 null)- Returns:
- 只要没有发生同步构建异常,就返回 true
-