При использовании версии Apache HttpClient:
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.6</version>
</dependency>
В чем разница между setHeader и addHeader?
httpPost.addHeader("AuthenticationKey",authenticationKey);
httpPost.addHeader("Content-Type","application/json");
httpPost.setHeader("Cache-Control", "no-cache"); // HTTP 1.1
httpPost.setHeader("Pragma", "no-cache"); // HTTP 1.0
httpPost.setHeader("X-Requested-With", "XMLHttpRequest"); // mimics a browser REST request