本文介绍了对于HttpGet方法,getParams()是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

HttpGet method = new HttpGet(url.toExternalForm());
method.getParams()

Whare是这些参数吗?它们是查询字符串吗?似乎没有简单的方法来添加查询字符串与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

推荐答案

根据到,您可以这样做:

According to the Http Client tutorial, you can do this:

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());

这篇关于对于HttpGet方法,getParams()是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 12:02