com.baidu.sapi2.http
类 JsonHttpResponseHandler

java.lang.Object
  继承者 com.baidu.sapi2.http.AsyncHttpResponseHandler
      继承者 com.baidu.sapi2.http.JsonHttpResponseHandler

public class JsonHttpResponseHandler
extends AsyncHttpResponseHandler

Used to intercept and handle the responses from requests made using AsyncHttpClient, with automatic parsing into a JSONObject or JSONArray.

This class is designed to be passed to get, post, put and delete requests with the onSuccess(JSONObject) or onSuccess(JSONArray) methods anonymously overridden.

Additionally, you can override the other event methods from the parent class.


字段摘要
protected static int SUCCESS_JSON_MESSAGE
           
 
从类 com.baidu.sapi2.http.AsyncHttpResponseHandler 继承的字段
FAILURE_MESSAGE, FINISH_MESSAGE, START_MESSAGE, SUCCESS_MESSAGE
 
构造方法摘要
JsonHttpResponseHandler()
           
 
方法摘要
protected  void handleFailureMessage(Throwable e, String responseBody)
           
protected  void handleMessage(android.os.Message msg)
           
protected  void handleSuccessJsonMessage(int statusCode, Object jsonResponse)
           
 void onFailure(Throwable e, org.json.JSONArray errorResponse)
           
 void onFailure(Throwable e, org.json.JSONObject errorResponse)
           
 void onSuccess(int statusCode, org.json.JSONArray response)
          Fired when a request returns successfully and contains a json array at the base of the response string.
 void onSuccess(int statusCode, org.json.JSONObject response)
          Fired when a request returns successfully and contains a json object at the base of the response string.
 void onSuccess(org.json.JSONArray response)
          Fired when a request returns successfully and contains a json array at the base of the response string.
 void onSuccess(org.json.JSONObject response)
          Fired when a request returns successfully and contains a json object at the base of the response string.
protected  Object parseResponse(String responseBody)
           
protected  void sendSuccessMessage(int statusCode, String responseBody)
           
 
从类 com.baidu.sapi2.http.AsyncHttpResponseHandler 继承的方法
handleSuccessMessage, obtainMessage, onFailure, onFailure, onFinish, onStart, onSuccess, onSuccess, sendFailureMessage, sendFailureMessage, sendFinishMessage, sendMessage, sendStartMessage
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

SUCCESS_JSON_MESSAGE

protected static final int SUCCESS_JSON_MESSAGE
另请参见:
常量字段值
构造方法详细信息

JsonHttpResponseHandler

public JsonHttpResponseHandler()
方法详细信息

onSuccess

public void onSuccess(org.json.JSONObject response)
Fired when a request returns successfully and contains a json object at the base of the response string. Override to handle in your own code.

参数:
response - the parsed json object found in the server response (if any)

onSuccess

public void onSuccess(org.json.JSONArray response)
Fired when a request returns successfully and contains a json array at the base of the response string. Override to handle in your own code.

参数:
response - the parsed json array found in the server response (if any)

onSuccess

public void onSuccess(int statusCode,
                      org.json.JSONObject response)
Fired when a request returns successfully and contains a json object at the base of the response string. Override to handle in your own code.

参数:
statusCode - the status code of the response
response - the parsed json object found in the server response (if any)

onSuccess

public void onSuccess(int statusCode,
                      org.json.JSONArray response)
Fired when a request returns successfully and contains a json array at the base of the response string. Override to handle in your own code.

参数:
statusCode - the status code of the response
response - the parsed json array found in the server response (if any)

onFailure

public void onFailure(Throwable e,
                      org.json.JSONObject errorResponse)

onFailure

public void onFailure(Throwable e,
                      org.json.JSONArray errorResponse)

sendSuccessMessage

protected void sendSuccessMessage(int statusCode,
                                  String responseBody)
覆盖:
AsyncHttpResponseHandler 中的 sendSuccessMessage

handleMessage

protected void handleMessage(android.os.Message msg)
覆盖:
AsyncHttpResponseHandler 中的 handleMessage

handleSuccessJsonMessage

protected void handleSuccessJsonMessage(int statusCode,
                                        Object jsonResponse)

parseResponse

protected Object parseResponse(String responseBody)
                        throws org.json.JSONException
抛出:
org.json.JSONException

handleFailureMessage

protected void handleFailureMessage(Throwable e,
                                    String responseBody)
覆盖:
AsyncHttpResponseHandler 中的 handleFailureMessage


Copyright © 2013. All Rights Reserved.