Class WebClientUtil

java.lang.Object
cn.net.pap.task.webclient.WebClientUtil

public class WebClientUtil extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
     
    static org.springframework.web.reactive.function.client.ClientResponse
    postBody(String url, String bodyJSON, org.springframework.http.HttpHeaders headers)
    WebClient post body json
    static String
    postBodyObjectSimple(String url, Object objectJSON, org.springframework.http.HttpHeaders headers, Integer maxByteCount)
    simple http post request body
    static boolean
    postBodyObjectSimpleBlindly(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>
    postMono(String url, String bodyJSON, org.springframework.http.HttpHeaders headers)
    异步POST请求 - 返回Mono,由调用方决定是否阻塞

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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