Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/350.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 对于HttpGet方法,getParams()是什么?_Java_Apache Httpclient 4.x - Fatal编程技术网

Java 对于HttpGet方法,getParams()是什么?

Java 对于HttpGet方法,getParams()是什么?,java,apache-httpclient-4.x,Java,Apache Httpclient 4.x,这些情人是什么?它们是查询字符串吗?似乎没有简单的方法可以使用org.apache.http.client.methods.HttpGet添加查询字符串。这些参数是http GET请求参数 例如,在URL中,参数username的值为mcjones。根据,可以执行以下操作: org.apache.http.client.methods.HttpGet; HttpGet method = new HttpGet(url.toExternalForm()); method.getParams()

这些情人是什么?它们是查询字符串吗?似乎没有简单的方法可以使用org.apache.http.client.methods.HttpGet添加查询字符串。这些参数是http GET请求参数

例如,在URL中,参数username的值为mcjones。

根据,可以执行以下操作:

org.apache.http.client.methods.HttpGet;

HttpGet method = new HttpGet(url.toExternalForm());
method.getParams()
发件人:

getParams

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());
公共HttpMethodParams getParams()


请求的完整参数列表可在

中找到。问题是关于httpclient 4.x的,您的答案是关于3.x的。
Returns HTTP protocol parameters associated with this method.

Specified by:
    getParams in interface HttpMethod

Returns:
    HTTP parameters.
Since:
    3.0
See Also:
    HttpMethodParams