use of com.qiyei.sdk.http.base.HttpRequest in project EssayJoke by qiyei2015.
the class OkHttpEngine method post.
@Override
public void post(HttpRequest httpRequest, final IHttpCallback callback) {
RequestBody requestBody = buildPostRequest(httpRequest);
Request request = new Request.Builder().url(httpRequest.getUrl()).post(requestBody).build();
LogManager.e("Post请求路径:", httpRequest.getUrl());
mClient.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
callback.onFail(e);
}
@Override
public void onResponse(Call call, Response response) throws IOException {
if (response != null && response.isSuccessful()) {
callback.onSuccess(response.body().string());
} else {
callback.onFail(new Exception("error"));
}
}
});
}
use of com.qiyei.sdk.http.base.HttpRequest in project EssayJoke by qiyei2015.
the class BannerTestActivity method buildRequest.
private HttpRequest buildRequest() {
HttpRequest request = new HttpRequest();
request.setUrl("http://is.snssdk.com/2/essay/discovery/v3/");
Map<String, Object> params = new HashMap<>();
params.put("iid", "6152551759");
params.put("aid", "7");
params.put("channel", 360);
addCommonParams(params);
request.setParams(params);
request.setRequestMethod(RequestMethod.GET);
request.setUseCache(true);
return request;
}
use of com.qiyei.sdk.http.base.HttpRequest in project EssayJoke by qiyei2015.
the class FindFragment method buildRequest.
private HttpRequest buildRequest() {
HttpRequest request = new HttpRequest();
request.setUrl("http://is.snssdk.com/2/essay/discovery/v3/");
Map<String, Object> params = new HashMap<>();
params.put("iid", "6152551759");
params.put("aid", "7");
params.put("channel", 360);
addCommonParams(params);
request.setParams(params);
request.setRequestMethod(RequestMethod.GET);
request.setUseCache(true);
return request;
}
use of com.qiyei.sdk.http.base.HttpRequest in project EssayJoke by qiyei2015.
the class OkHttpEngine method get.
@Override
public void get(HttpRequest req, final IHttpCallback callback) {
String url = HttpHelper.buildGetRequest(req);
LogManager.e("Get请求路径:", url);
okhttp3.Request.Builder builder = new okhttp3.Request.Builder().url(url);
Request request = builder.build();
mClient.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
callback.onFail(e);
}
@Override
public void onResponse(Call call, Response response) throws IOException {
if (response != null && response.isSuccessful()) {
callback.onSuccess(response.body().string());
} else {
callback.onFail(new Exception("error"));
}
}
});
}
Aggregations