本文介绍了对于 HttpGet 方法,什么是 getParams()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
限时送ChatGPT账号..org.apache.http.client.methods.HttpGet;
HttpGet method = new HttpGet(url.toExternalForm());
method.getParams()
这些参数是什么?它们是查询字符串吗?似乎没有简单的方法可以使用 org.apache.http.client.methods.HttpGet 来添加查询字符串
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
推荐答案
根据 Http客户端教程,你可以这样做:
According to the Http Client tutorial, you can do this:
URI uri = new URIBuilder()
.setScheme("http")
.setHost("www.google")
.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());
这篇关于对于 HttpGet 方法,什么是 getParams()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论