0
我知道如何在android中发送post请求。我使用下面的示例代码:发送HttpPost请求时的HttpEntity概念
...
HttpPost httpPostRequest = new HttpPost(url);
private ArrayList <NameValuePair> params = new ArrayList<NameValuePair>();
private ArrayList <NameValuePair> headers = new ArrayList<NameValuePair>();
.....
for(int i = 0; i < headers.size(); i++) {
StringEntity entity = new StringEntity(headers.get(i).getValue(),"UTF-8");
httpPostRequest.setEntity(entity);
}
if(!params.isEmpty()){
HttpEntity httpEntity = new UrlEncodedFormEntity(params,HTTP.UTF_8);
httpPostRequest.setEntity(httpEntity);
}
String serverResponse = executeRequest(httpPostRequest);
...
我只是想知道什么是HttpEntity
概念? HttpEntity
类背后有什么想法?