@Override public void onFailure( int statusCode, Header[] headers, String responseString, Throwable throwable) { if (!mIsSilent) { if (mContext != null) { if (Utils.isNetworkConnected(mContext)) { ToastUtil.make(mContext).show(R.string.common_toast_connectionnodata); } else { ToastUtil.make(mContext).show(R.string.common_toast_connectionfailed); } Log.i("http response", responseString); JSONObject errorJsonObject = new JSONObject(); try { errorJsonObject.put("code", "-123789"); errorJsonObject.put("msg", responseString); } catch (JSONException e) { e.printStackTrace(); } if (mAsyncHttpResponseHandler != null) { mAsyncHttpResponseHandler.onFailure(statusCode, headers, throwable, errorJsonObject); } else { onFailure(statusCode, headers, throwable, errorJsonObject); } } } else { super.onFailure(statusCode, headers, responseString, throwable); } }
@Override public void onStart() { if (mContext != null) { if (mAsyncHttpResponseHandler == null) { super.onStart(); } else { mAsyncHttpResponseHandler.onStart(); } } }
@Override public void onSuccess(int statusCode, Header[] headers, JSONObject response) { Log.i("http result", response.toString()); try { // 补充完整系统级参数 switch (response.getInt("code")) { case Constant.CODE_TIMEOUT: case Constant.CODE_DATA_ERROR: case Constant.CODE_DB_ERROR: case Constant.CODE_SERVICE_ERROR: case Constant.CODE_USER_PERMISSIONS: case Constant.CODE_SERVICE_UNAVAILABLE: case Constant.CODE_MISSING_METHOD: case Constant.CODE_ASIGN_UNVALID: case Constant.CODE_MISSING_API_VERSION: case Constant.CODE_API_VERSION_ERROR: case Constant.CODE_TOKEN_EXPIRES: case Constant.CODE_DATA_CONFLICT: if (!mIsSilent) { if (mContext != null) { ToastUtil.make(mContext).show(R.string.common_toast_error); } } break; case Constant.CODE_RELOGIN: // re-login if (mContext != null) { // mContext.sendOrderedBroadcast(new Intent( // UserUtil.ACTION_RELOGIN), null); } break; case Constant.CODE_USER_LOCKED: case Constant.CODE_SUCCESS: case Constant.CODE_FAILURE: default: if (mContext != null) { if (mAsyncHttpResponseHandler == null) { super.onSuccess(statusCode, headers, response); } else { mAsyncHttpResponseHandler.onSuccess(statusCode, headers, response); } } break; } } catch (JSONException e) { super.onSuccess(statusCode, headers, response); e.printStackTrace(); } }
public final void run() { if (!JsonHttpResponseHandler.this.useRFC5179CompatibilityMode && this.val$jsonResponse == null) { JsonHttpResponseHandler.this.onSuccess$79de7b53(null); } else if (this.val$jsonResponse instanceof JSONObject) { JsonHttpResponseHandler.this.onSuccess( C04791.this.val$statusCode, C04791.this.val$headers, (JSONObject) this.val$jsonResponse); } else if (this.val$jsonResponse instanceof JSONArray) { AsyncHttpClient.log.m20w( "JsonHttpRH", "onSuccess(int, Header[], JSONArray) was not overriden, but callback was received"); } else if (!(this.val$jsonResponse instanceof String)) { JsonHttpResponseHandler.onFailure$6af5acc( new JSONException( "Unexpected response type " + this.val$jsonResponse.getClass().getName())); } else if (JsonHttpResponseHandler.this.useRFC5179CompatibilityMode) { JsonHttpResponseHandler.this.onFailure( C04791.this.val$statusCode, C04791.this.val$headers, (String) this.val$jsonResponse, new JSONException("Response cannot be parsed as JSON data")); } else { JsonHttpResponseHandler.this.onSuccess$79de7b53((String) this.val$jsonResponse); } }
@Override public void onFailure( int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { Log.i("http result", throwable.toString()); if (!mIsSilent) { if (mContext != null) { if (Utils.isNetworkConnected(mContext)) { ToastUtil.make(mContext).show(R.string.common_toast_connectionnodata); } else { ToastUtil.make(mContext).show(R.string.common_toast_connectionfailed); } if (mAsyncHttpResponseHandler != null) { mAsyncHttpResponseHandler.onFailure(statusCode, headers, throwable, errorResponse); } else { super.onFailure(statusCode, headers, throwable, errorResponse); } } } else { super.onFailure(statusCode, headers, throwable, errorResponse); } }
public final void run() { if (!JsonHttpResponseHandler.this.useRFC5179CompatibilityMode && this.val$jsonResponse == null) { JsonHttpResponseHandler.this.onFailure( C04822.this.val$statusCode, C04822.this.val$headers, null, C04822.this.val$throwable); } else if (this.val$jsonResponse instanceof JSONObject) { JsonHttpResponseHandler.onFailure$6af5acc(C04822.this.val$throwable); } else if (this.val$jsonResponse instanceof JSONArray) { AsyncHttpClient.log.m21w( "JsonHttpRH", "onFailure(int, Header[], Throwable, JSONArray) was not overriden, but callback was received", C04822.this.val$throwable); } else if (this.val$jsonResponse instanceof String) { JsonHttpResponseHandler.this.onFailure( C04822.this.val$statusCode, C04822.this.val$headers, (String) this.val$jsonResponse, C04822.this.val$throwable); } else { JsonHttpResponseHandler.onFailure$6af5acc( new JSONException( "Unexpected response type " + this.val$jsonResponse.getClass().getName())); } }
public final void run() { JsonHttpResponseHandler.onFailure$6af5acc(this.val$ex); }
@Override public void onSuccess(int statusCode, Header[] headers, JSONArray response) { super.onSuccess(statusCode, headers, response); success(response); }
public void onFailure(int statusCode, Header[] headers, String responseBody, Throwable e) { super.onFailure(statusCode, headers, responseBody, e); failure(statusCode, responseBody, e); }
@Override public void onFailure( int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { super.onFailure(statusCode, headers, throwable, errorResponse); onJsonHttpFailure(errorResponse); }
@Override public void onSuccess(int statusCode, Header[] headers, JSONObject response) { super.onSuccess(statusCode, headers, response); log(getRequest() + "-->" + response); }
@Override public void onCancel() { super.onCancel(); log("onCancel" + ":" + getRequest()); }
@Override public void onFinish() { super.onFinish(); log("onFinish" + ":" + getRequest()); }
@Override public void onStart() { super.onStart(); log("onStart" + ":" + getRequest()); }
@Override public void onFailure( int statusCode, Header[] headers, String responseString, Throwable throwable) { super.onFailure(statusCode, headers, responseString, throwable); onInnovationExceptionFinish(); }
@Override public void onFailure( int statusCode, Header[] headers, Throwable throwable, JSONArray errorResponse) { super.onFailure(statusCode, headers, throwable, errorResponse); onInnovationExceptionFinish(); }
@Override public void onSuccess(int statusCode, Header[] headers, JSONObject response) { super.onSuccess(statusCode, headers, response); onJsonHttpSuccess(response); }