我想使用 java 对象传递给 HTTP POST 参数java.net.*
?该对象包含多个参数。
问问题
17777 次
1 回答
2
尝试
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(REQUEST_URL);
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
//put here in nameValuePairs request parameters
UrlEncodedFormEntity form;
form = new UrlEncodedFormEntity(nameValuePairs, "UTF-8");
form.setContentEncoding(HTTP.UTF_8);
httppost.setEntity(form);
HttpResponse response = httpclient.execute(httppost);
于 2013-02-01T11:46:48.683 回答