Package cn.toint.oktool.util
Class HttpClientUtil
java.lang.Object
cn.toint.oktool.util.HttpClientUtil
- Author:
- Toint
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.dromara.hutool.http.client.engine.ClientEngine获取单例 http 客户端static org.dromara.hutool.http.client.engine.ClientEngineclientEngine(Class<? extends org.dromara.hutool.http.client.engine.ClientEngine> clientEngineClass, org.dromara.hutool.http.client.ClientConfig clientConfig) 创建 http 客户端static voidinitGlobalConfig(Class<? extends org.dromara.hutool.http.client.engine.ClientEngine> clientEngineClass, org.dromara.hutool.http.client.ClientConfig clientConfig, Duration globalTimeout) 初始化全局配置
-
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, 默认:JdkClientEngineclientConfig- 客户端配置, 允许 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, 默认JdkClientEngineclientConfig- 客户端配置, 默认超时时间: 10sglobalTimeout- 全局超时时间, 默认: 10s
-