1、httpPost 设置header,header内容是在发送请求的头文件里面

HttpPost httpPost = new HttpPost(url);
如:
Accept    text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding    gzip, deflate
Accept-Language    zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3

2、StringEntity 设置header,header内容是在发送的内容里面

StringEntity stringEntity = new StringEntity(data, ToolString.encoding);
如:



3、HttpResponse 设置header,header内容是在获取返回信息的头文件里面

HttpResponse response = httpClient.execute(httpPost);