RequestConfig配置类中各参数的意思

参数介绍

RequestConfig requestConfig = RequestConfig.custom()
        .setConnectionRequestTimeout(5000) // 超5秒还没返回新的可用链接,抛ConnectionPoolTimeoutException。默认值为0,表示无限等待。
        .setConnectTimeout(5000) // 超5秒还没建立链接,抛ConnectTimeoutException。默认值为0,表示无限等待。
		.setSocketTimeout(5000) // 超5秒还没返回数据,抛SocketTimeoutException。默认值为0,表示无限等待。
        .build();

Further Reading

[实践总结] 使用Apache HttpClient 4.x进行进行一次Http请求
RequestConfig配置类中各参数的意思
CloseableHttpClient 中各参数的意思

参考:http RequestConfig配置类中各参数的意思

猜你喜欢

转载自blog.csdn.net/weixin_37646636/article/details/134542842