4
我在android上使用apache.http,大部分工作正常,但是当我尝试使用参数执行get请求时,这些都没有被发送。我究竟做错了什么?这里是只得到这个没有PARAMSHttpGet params没有被发送
GET /api/v1/activity/ HTTP/1.1
Host: example.com
Connection: Keep-Alive
Accept-Encoding: gzip
Accept: application/json, text/javascript, */*; q=0.01
任何想法的代码
HttpClient httpclient = new DefaultHttpClient();
HttpUriRequest request = new HttpGet(uri);
HttpParams p = new BasicHttpParams();
p.setParameter("param", "value");
request.setParams(p);
request.setHeader("Accept", "application/json, text/javascript, */*; q=0.01");
HttpResponse response = null;
try {
response = httpclient.execute(request);
} catch (ClientProtocolException e) {
e.printStackTrace();
}
在服务器上的IM?
这个伟大的工程,我使用它,但现在根据每个人的setParams方法应该做的伎俩。这很古怪。 – manuel 2013-03-09 03:56:51
看起来应该是这样,但我从来没有见过使用'setParams()'的例子。即使Apache的官方示例也使用URIBuilder的setParameter方法在URI中构建参数。 – 323go 2013-03-10 02:32:34