|
17 | 17 |
|
18 | 18 | import com.fasterxml.jackson.databind.ObjectMapper; |
19 | 19 | import org.apache.commons.lang3.StringUtils; |
20 | | -import org.apache.http.HttpStatus; |
21 | | -import org.apache.http.StatusLine; |
22 | | -import org.apache.http.client.ResponseHandler; |
23 | | -import org.apache.http.client.methods.CloseableHttpResponse; |
24 | | -import org.apache.http.client.methods.HttpGet; |
25 | | -import org.apache.http.client.methods.HttpPost; |
26 | | -import org.apache.http.entity.ContentType; |
27 | | -import org.apache.http.entity.StringEntity; |
28 | | -import org.apache.http.impl.client.BasicResponseHandler; |
29 | | -import org.apache.http.impl.client.CloseableHttpClient; |
30 | | -import org.apache.http.impl.client.HttpClients; |
| 20 | +import org.apache.hc.client5.http.classic.methods.HttpGet; |
| 21 | +import org.apache.hc.client5.http.classic.methods.HttpPost; |
| 22 | +import org.apache.hc.client5.http.impl.classic.BasicHttpClientResponseHandler; |
| 23 | +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; |
| 24 | +import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse; |
| 25 | +import org.apache.hc.client5.http.impl.classic.HttpClients; |
| 26 | +import org.apache.hc.core5.http.ContentType; |
| 27 | +import org.apache.hc.core5.http.HttpStatus; |
| 28 | +import org.apache.hc.core5.http.io.HttpClientResponseHandler; |
| 29 | +import org.apache.hc.core5.http.io.entity.StringEntity; |
31 | 30 | import org.apache.logging.log4j.LogManager; |
32 | 31 | import org.apache.logging.log4j.Logger; |
33 | 32 | import org.jetbrains.annotations.NotNull; |
@@ -118,7 +117,7 @@ public TransferResult transfer(@NotNull TransferEndpoint source, @NotNull Transf |
118 | 117 |
|
119 | 118 | try (CloseableHttpResponse response = httpClient.execute(httpPost)) |
120 | 119 | { |
121 | | - ResponseHandler<String> handler = new BasicResponseHandler(); |
| 120 | + HttpClientResponseHandler<String> handler = new BasicHttpClientResponseHandler(); |
122 | 121 | // StatusLine status = response.getStatusLine(); |
123 | 122 | // TODO check what happens in the error cases |
124 | 123 | String contents = handler.handleResponse(response); |
@@ -170,10 +169,9 @@ private Object makeApiGetRequest(URI uri, Class clazz) throws IOException |
170 | 169 |
|
171 | 170 | try (CloseableHttpResponse response = httpClient.execute(httpGet)) |
172 | 171 | { |
173 | | - ResponseHandler<String> handler = new BasicResponseHandler(); |
174 | | - StatusLine status = response.getStatusLine(); |
| 172 | + BasicHttpClientResponseHandler handler = new BasicHttpClientResponseHandler(); |
175 | 173 |
|
176 | | - if (status.getStatusCode() == HttpStatus.SC_OK) |
| 174 | + if (response.getCode() == HttpStatus.SC_OK) |
177 | 175 | { |
178 | 176 | String contents = handler.handleResponse(response); |
179 | 177 | ObjectMapper mapper = new ObjectMapper(); |
|
0 commit comments