Skip to content

Commit 7664e43

Browse files
authored
Migrate to HttpClient 5.x (#35)
1 parent 5219e03 commit 7664e43

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

src/org/labkey/filetransfer/globus/GlobusFileTransferProvider.java

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,16 @@
1717

1818
import com.fasterxml.jackson.databind.ObjectMapper;
1919
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;
3130
import org.apache.logging.log4j.LogManager;
3231
import org.apache.logging.log4j.Logger;
3332
import org.jetbrains.annotations.NotNull;
@@ -118,7 +117,7 @@ public TransferResult transfer(@NotNull TransferEndpoint source, @NotNull Transf
118117

119118
try (CloseableHttpResponse response = httpClient.execute(httpPost))
120119
{
121-
ResponseHandler<String> handler = new BasicResponseHandler();
120+
HttpClientResponseHandler<String> handler = new BasicHttpClientResponseHandler();
122121
// StatusLine status = response.getStatusLine();
123122
// TODO check what happens in the error cases
124123
String contents = handler.handleResponse(response);
@@ -170,10 +169,9 @@ private Object makeApiGetRequest(URI uri, Class clazz) throws IOException
170169

171170
try (CloseableHttpResponse response = httpClient.execute(httpGet))
172171
{
173-
ResponseHandler<String> handler = new BasicResponseHandler();
174-
StatusLine status = response.getStatusLine();
172+
BasicHttpClientResponseHandler handler = new BasicHttpClientResponseHandler();
175173

176-
if (status.getStatusCode() == HttpStatus.SC_OK)
174+
if (response.getCode() == HttpStatus.SC_OK)
177175
{
178176
String contents = handler.handleResponse(response);
179177
ObjectMapper mapper = new ObjectMapper();

0 commit comments

Comments
 (0)