HttpClient发送带路径参数的请求
例:www.123.xyz?name=Tom&age=34
String url = "www.123.com";
try {
URIBuilder newBuilder = new URIBuilder(url);
newBuilder.addParameter("name", "Tom");
newBuilder.addParameter("age", "34");
HttpPost httpPost = new HttpPost(newBuilder.build());
System.out.println(httpPost.getURI());
} catch (URISyntaxException e) {
e.printStackTrace();
}