org.apache.http.client.methods.HttpGet;
HttpGet method = new HttpGet(url.toExternalForm());
method.getParams()
Whare是这些参数吗?它们是查询字符串吗?似乎没有简单的方法来添加org.apache.http.client.methods.HttpGet的查询字符串
答案 0 :(得分:14)
根据Http Client tutorial,你可以这样做:
URI uri = new URIBuilder()
.setScheme("http")
.setHost("www.google.com")
.setPath("/search")
.setParameter("q", "httpclient")
.setParameter("btnG", "Google Search")
.setParameter("aq", "f")
.setParameter("oq", "")
.build();
HttpGet httpget = new HttpGet(uri);
System.out.println(httpget.getURI());
答案 1 :(得分:0)
这些参数是HTTP GET请求参数。
例如,在网址 http://www.mysite.com/login?username=mcjones 中,参数username的值为mcjones。
答案 2 :(得分:0)
找到请求的完整参数列表getParams
public HttpMethodParams getParams()
Returns HTTP protocol parameters associated with this method. Specified by: getParams in interface HttpMethod Returns: HTTP parameters. Since: 3.0 See Also: HttpMethodParams