16
16
import jakarta .inject .Inject ;
17
17
import jakarta .inject .Named ;
18
18
19
- import org .apache .commons .httpclient .HttpStatus ;
20
- import org .apache .commons .httpclient .NameValuePair ;
21
19
import org .apache .http .HttpEntity ;
22
20
import org .apache .http .HttpResponse ;
23
21
import org .apache .http .client .methods .HttpGet ;
@@ -208,11 +206,7 @@ private JsonNode getGeoLocation(String ip, String urlPattern, int timeout) {
208
206
209
207
}
210
208
211
- private String getUrlContents (String url , int timeout ) throws Exception {
212
- return getUrlContents (url , Collections .emptyList (), timeout );
213
- }
214
-
215
- private String getUrlContents (String url , List <NameValuePair > nvPairList , int timeout ) throws Exception {
209
+ private String getUrlContents (String url , int timeout ) throws Exception {
216
210
217
211
String contents = null ;
218
212
@@ -223,15 +217,14 @@ private String getUrlContents(String url, List<NameValuePair> nvPairList, int ti
223
217
224
218
HttpGet httpGet = new HttpGet (url );
225
219
URIBuilder uribe = new URIBuilder (httpGet .getURI ());
226
- nvPairList .forEach (pair -> uribe .addParameter (pair .getName (), pair .getValue ()));
227
220
228
221
httpGet .setURI (uribe .build ());
229
222
httpGet .setHeader ("Accept" , "application/json" );
230
223
HttpResponse response = client .execute (httpGet );
231
224
HttpEntity entity = response .getEntity ();
232
225
233
226
logger .debug ("GET request is {}" , httpGet .getURI ());
234
- if (response .getStatusLine ().getStatusCode () == HttpStatus . SC_OK ) {
227
+ if (response .getStatusLine ().getStatusCode () == 200 ) {
235
228
contents = EntityUtils .toString (entity );
236
229
}
237
230
EntityUtils .consume (entity );
0 commit comments