|
38 | 38 | import org.apache.hc.client5.http.io.HttpClientConnectionManager; |
39 | 39 | import org.apache.hc.client5.http.protocol.HttpClientContext; |
40 | 40 | import org.apache.hc.core5.http.ClassicHttpRequest; |
41 | | -import org.apache.hc.core5.http.io.SocketConfig; |
42 | 41 | import org.apache.hc.core5.http.protocol.HttpContext; |
43 | 42 | import org.jspecify.annotations.Nullable; |
44 | 43 |
|
@@ -68,8 +67,6 @@ public class HttpComponentsClientHttpRequestFactory implements ClientHttpRequest |
68 | 67 |
|
69 | 68 | private @Nullable BiFunction<HttpMethod, URI, HttpContext> httpContextFactory; |
70 | 69 |
|
71 | | - private long connectTimeout = -1; |
72 | | - |
73 | 70 | private long connectionRequestTimeout = -1; |
74 | 71 |
|
75 | 72 | private long readTimeout = -1; |
@@ -110,44 +107,6 @@ public HttpClient getHttpClient() { |
110 | 107 | return this.httpClient; |
111 | 108 | } |
112 | 109 |
|
113 | | - /** |
114 | | - * Set the connection timeout for the underlying {@link RequestConfig}. |
115 | | - * A timeout value of 0 specifies an infinite timeout. |
116 | | - * <p>Additional properties can be configured by specifying a |
117 | | - * {@link RequestConfig} instance on a custom {@link HttpClient}. |
118 | | - * <p>This options does not affect connection timeouts for SSL |
119 | | - * handshakes or CONNECT requests; for that, it is required to |
120 | | - * use the {@link SocketConfig} on the |
121 | | - * {@link HttpClient} itself. |
122 | | - * @param connectTimeout the timeout value in milliseconds |
123 | | - * @see RequestConfig#getConnectTimeout() |
124 | | - * @see SocketConfig#getSoTimeout |
125 | | - */ |
126 | | - public void setConnectTimeout(int connectTimeout) { |
127 | | - Assert.isTrue(connectTimeout >= 0, "Timeout must be a non-negative value"); |
128 | | - this.connectTimeout = connectTimeout; |
129 | | - } |
130 | | - |
131 | | - /** |
132 | | - * Set the connection timeout for the underlying {@link RequestConfig}. |
133 | | - * A timeout value of 0 specifies an infinite timeout. |
134 | | - * <p>Additional properties can be configured by specifying a |
135 | | - * {@link RequestConfig} instance on a custom {@link HttpClient}. |
136 | | - * <p>This options does not affect connection timeouts for SSL |
137 | | - * handshakes or CONNECT requests; for that, it is required to |
138 | | - * use the {@link SocketConfig} on the |
139 | | - * {@link HttpClient} itself. |
140 | | - * @param connectTimeout the timeout as a {@code Duration}. |
141 | | - * @since 6.1 |
142 | | - * @see RequestConfig#getConnectTimeout() |
143 | | - * @see SocketConfig#getSoTimeout |
144 | | - */ |
145 | | - public void setConnectTimeout(Duration connectTimeout) { |
146 | | - Assert.notNull(connectTimeout, "ConnectTimeout must not be null"); |
147 | | - Assert.isTrue(!connectTimeout.isNegative(), "Timeout must be a non-negative value"); |
148 | | - this.connectTimeout = connectTimeout.toMillis(); |
149 | | - } |
150 | | - |
151 | 110 | /** |
152 | 111 | * Set the timeout in milliseconds used when requesting a connection |
153 | 112 | * from the connection manager using the underlying {@link RequestConfig}. |
@@ -295,16 +254,12 @@ private static boolean hasCustomRequestConfig(HttpContext context) { |
295 | 254 | * @return the merged request config |
296 | 255 | * @since 4.2 |
297 | 256 | */ |
298 | | - @SuppressWarnings("deprecation") // setConnectTimeout |
299 | 257 | protected RequestConfig mergeRequestConfig(RequestConfig clientConfig) { |
300 | | - if (this.connectTimeout == -1 && this.connectionRequestTimeout == -1 && this.readTimeout == -1) { // nothing to merge |
| 258 | + if (this.connectionRequestTimeout == -1 && this.readTimeout == -1) { // nothing to merge |
301 | 259 | return clientConfig; |
302 | 260 | } |
303 | 261 |
|
304 | 262 | RequestConfig.Builder builder = RequestConfig.copy(clientConfig); |
305 | | - if (this.connectTimeout >= 0) { |
306 | | - builder.setConnectTimeout(this.connectTimeout, TimeUnit.MILLISECONDS); |
307 | | - } |
308 | 263 | if (this.connectionRequestTimeout >= 0) { |
309 | 264 | builder.setConnectionRequestTimeout(this.connectionRequestTimeout, TimeUnit.MILLISECONDS); |
310 | 265 | } |
|
0 commit comments