问题:
http client fluent demo
解决:
|
final String url = "http://****"; final org.apache.http.client.fluent.Response c = org.apache.http.client.fluent.Request.Get(url) .addHeader("Authorization", "auth").execute(); final HttpResponse httpResp = c.returnResponse(); System.out.println(httpResp.getStatusLine()); final String str = IOUtils.toString(httpResp.getEntity().getContent(), "utf-8"); System.out.println(str); |
参考: