示例#1
0
  private void triggerResponseHandler(HttpResponse httpResponse) {
    // For more simplify interface to handle the response
    if (responseLiteListener != null) responseLiteListener.onFinished(httpResponse);

    if (responseListener == null) return;

    // Invalid request
    if (httpResponse.isCorrupt()) {
      responseListener.onCorrupt();
      return;
    }

    int status = httpResponse.getStatusCode();
    if (status >= 500) {
      responseListener.onInternalError(httpResponse);
    } else if (status >= 400) {
      responseListener.onFailed(httpResponse);
    } else if (status >= 300) {
      responseListener.onRedirect(httpResponse);
    } else if (status >= 200) {
      responseListener.onSuccess(httpResponse);
    }
  }
示例#2
0
 @Override
 public void onSuccess(int statusCode, Header[] headers, String responseString) {
   responseListener.onSuccess(responseString);
 }