在httpclient5中实现HttpRequestRetryHandler和RequestBuilder

3

我计划更新我的项目以使用httpclient5。
在此之后,我发现在httpclient5(5.0、5.01和5.0.2)中,它们不再有HttPRequestRetryHandler和RequestBuilder类。
是否有任何方法或更新可以在http5中不使用这些类,或者我们有一些具有相同功能的替代方案?

1个回答

3
  1. 请使用org.apache.hc.client5.http.HttpRequestRetryStrategy

  2. 请在经典传输中使用org.apache.hc.core5.http.io.support.ClassicRequestBuilder,在异步传输中使用org.apache.hc.core5.http.nio.support.AsyncRequestBuilder

一般来说,在从Apache HttpClient 4.5.x迁移到Apache HttpClient 5.x时,这个资源可能会很有用。

https://ok2c.github.io/httpclient-migration-guide/


它运行得非常完美,只是ClassicRequestBuilder没有setConfig(method)方法。你有什么建议吗,ok2c? - Thanh Huy Le
1
请使用HttpClientContext#setRequestConfig代替。 - ok2c

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接