use of com.benmu.framework.model.AxiosGet in project WeexErosFramework by bmfe.
the class EventFetch method fetch.
public void fetch(String params, final Context context, final JSCallback jscallback) {
ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
AxiosManager axiosManager = ManagerFactory.getManagerService(AxiosManager.class);
JSONObject object = parseManager.parseObject(params);
final String mUrl = object.getString("url");
Boolean noRepeat = object.getBoolean("noRepeat");
if (noRepeat != null && noRepeat) {
axiosManager.cancel(mUrl);
}
switch(object.getString("method")) {
case OkHttpUtils.METHOD.GET:
AxiosGet axiosGet = parseManager.parseObject(params, AxiosGet.class);
get(context, axiosManager, axiosGet, jscallback);
break;
case OkHttpUtils.METHOD.POST:
AxiosPost axiosPost = parseManager.parseObject(params, AxiosPost.class);
post(context, axiosManager, axiosPost, jscallback);
break;
case OkHttpUtils.METHOD.HEAD:
AxiosGet axiosHead = parseManager.parseObject(params, AxiosGet.class);
head(context, axiosManager, axiosHead, jscallback);
break;
case OkHttpUtils.METHOD.DELETE:
AxiosPost axiosDelete = parseManager.parseObject(params, AxiosPost.class);
delete(context, axiosManager, axiosDelete, jscallback);
break;
case OkHttpUtils.METHOD.PUT:
AxiosPost axiosPut = parseManager.parseObject(params, AxiosPost.class);
put(context, axiosManager, axiosPut, jscallback);
break;
case OkHttpUtils.METHOD.PATCH:
AxiosPost axiosPatch = parseManager.parseObject(params, AxiosPost.class);
patch(context, axiosManager, axiosPatch, jscallback);
break;
}
}
Aggregations