Class HttpClientUtil

java.lang.Object
cn.toint.oktool.util.HttpClientUtil

public class HttpClientUtil extends Object
Author:
Toint
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.dromara.hutool.http.client.engine.ClientEngine
    获取单例 http 客户端
    static org.dromara.hutool.http.client.engine.ClientEngine
    clientEngine(Class<? extends org.dromara.hutool.http.client.engine.ClientEngine> clientEngineClass, org.dromara.hutool.http.client.ClientConfig clientConfig)
    创建 http 客户端
    static void
    initGlobalConfig(Class<? extends org.dromara.hutool.http.client.engine.ClientEngine> clientEngineClass, org.dromara.hutool.http.client.ClientConfig clientConfig, Duration globalTimeout)
    初始化全局配置

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • HttpClientUtil

      public HttpClientUtil()
  • Method Details

    • clientEngine

      @Nonnull public static org.dromara.hutool.http.client.engine.ClientEngine clientEngine(@Nullable Class<? extends org.dromara.hutool.http.client.engine.ClientEngine> clientEngineClass, @Nullable org.dromara.hutool.http.client.ClientConfig clientConfig)
      创建 http 客户端
      Parameters:
      clientEngineClass - 客户端, 允许 null, 默认: JdkClientEngine
      clientConfig - 客户端配置, 允许 null, 默认超时时间: 10s
      Returns:
      单例 http 客户端
    • clientEngine

      @Nonnull public static org.dromara.hutool.http.client.engine.ClientEngine clientEngine()
      获取单例 http 客户端
      Returns:
      ClientEngine 单例 http 客户端
    • initGlobalConfig

      public static void initGlobalConfig(@Nullable Class<? extends org.dromara.hutool.http.client.engine.ClientEngine> clientEngineClass, @Nullable org.dromara.hutool.http.client.ClientConfig clientConfig, @Nullable Duration globalTimeout)
      初始化全局配置
      Parameters:
      clientEngineClass - 客户端, 允许 null, 默认 JdkClientEngine
      clientConfig - 客户端配置, 默认超时时间: 10s
      globalTimeout - 全局超时时间, 默认: 10s