Expand my Community achievements bar.

DefaultHttpClient is depricated in AEM-6.4


Level 4

Dear All,

I am following the below help document for displaying data from a Restful Web Service.

Creating an Adobe Experience Manager 6.4 HTL Component that displays data from a Restful Web Service

But when I am writing the code for HeroRestComponent.java , then I am getting deprecated message , as shown below.


I am using AEM-6.4. Am I missing something ?

3 Replies


Community Advisor


Please check the dependency at http://localhost:4502/system/console/depfinder 

and include in pom, for 6.4 I found below:







Arun Patidar


Community Advisor

Hi Sunitha

  Please check this blog https://www.mkyong.com/java/the-type-defaulthttpclient-is-deprecated/  . This talks about the same issue. I also tried the same. You can rewrite the code like below

HttpClient client = HttpClientBuilder.create().build(); 

HttpGet getRequest = new HttpGet("http://services.groupkt.com/country/get/iso2code/"+code);

getRequest.addHeader("accept", "application/json");

HttpResponse response = client.execute(getRequest);

PS:- I have not executed the code. But guess this should work from little bit of googling Happy coding .




Employee Advisor

I just checked (AEM 6.5, but 6.4 should be very similar), and there is a bundle "org.apache.httpcomponents.httpclient", which exports the java namespaces "org.apache.http.{auth,client,conn, impl}". You should be able to adapt your code to fix this deprecation easily.

(If it's working can you raise a ticket with Adobe support and ask if this example can be adapted? Thanks!)