use of com.lidroid.xutils.http.ResponseStream in project xUtils by wyouflf.
the class HttpFragment method testGetSync.
// 同步请求 必须在异步块儿中执行
private String testGetSync() {
RequestParams params = new RequestParams();
params.addQueryStringParameter("wd", "lidroid");
HttpUtils http = new HttpUtils();
http.configCurrentHttpCacheExpiry(1000 * 10);
try {
ResponseStream responseStream = http.sendSync(HttpRequest.HttpMethod.GET, "http://www.baidu.com/s", params);
//Header[] headers = responseStream.getBaseResponse().getAllHeaders();
return responseStream.readString();
} catch (Exception e) {
LogUtils.e(e.getMessage(), e);
}
return null;
}
Aggregations