对于 HttpGet 方法,getParams() 是什么?
org.apache.http.client.methods.HttpGet;
HttpGet method = new HttpGet(url.toExternalForm());
method.getParams()
这些参数是什么?它们是查询字符串吗?似乎没有简单的方法可以使用 org.apache.http.client.methods.HttpGet 添加查询字符串
org.apache.http.client.methods.HttpGet;
HttpGet method = new HttpGet(url.toExternalForm());
method.getParams()
Whare are these params? Are they the query string? there seems to be no easy way to add a query string with org.apache.http.client.methods.HttpGet
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
根据Http Client教程,你可以这样做:
According to the Http Client tutorial, you can do this:
这些参数是 HTTP GET 请求参数。
例如,在 URL http://www.mysite.com/login?username= mcjones,参数 username 的值为 mcjones。
These parameters are the HTTP GET request parameters.
For instance in the URL http://www.mysite.com/login?username=mcjones, the parameter username has value mcjones.
来自 http ://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/HttpMethodBase.html#getParams%28%29:
请求参数的完整列表可以在 http://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/params/HttpMethodParams.html
From http://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/HttpMethodBase.html#getParams%28%29 :
The full list of parameters for the request can be found at http://hc.apache.org/httpclient-3.x/apidocs/org/apache/commons/httpclient/params/HttpMethodParams.html