Why I am getting DefaultHttpClient is deprecated?
httpclient, java
Solution
Use this:
HttpClient httpclient = HttpClientBuilder.create().build();
Refer to this stackoverflow post
Problem
I am working on a project in which I need to make a call to my service and my service will return the data back in JSON format. And I don't need to serialize this JSON response to any POJO, I just need to get the data back as String. And this application is very performance critical so `HttpClient` has to be pretty fast So I decided to use Apache HttpClient or is there any better alternative which I can use? ``` DefaultHttpClient httpclient = new DefaultHttpClient(); HttpUriRequest request = new HttpGet("some-url"); request.addHeader("Context", "some-value"); HttpResponse response = httpClient.execute(request); String response = IOUtils.toString(response.getEntity().getContent(), "UTF-8"); ``` But it complains that `The type DefaultHttpClient is deprecated` so maybe they have new version of `HttpClient` or some other way of making a HttpClient call to an URL? Is there anything I am missing?