Class AGJSONHandler

java.lang.Object
com.franz.agraph.http.handler.AGResponseHandler
com.franz.agraph.http.handler.AGJSONHandler

public class AGJSONHandler extends AGResponseHandler
  • Constructor Details

    • AGJSONHandler

      public AGJSONHandler()
  • Method Details

    • handleResponse

      public void handleResponse(org.apache.http.HttpResponse httpResponse, HttpUriRequest httpUriRequest) throws IOException, AGHttpException
      Parse http response as a JSON object. We must invoke different parsers if the response contains an array or an object.
      Specified by:
      handleResponse in class AGResponseHandler
      Throws:
      IOException
      AGHttpException
    • getResult

      public JSONObject getResult() throws JSONException
      Returns:
      the JSONObject parsed from the response
      Throws:
      JSONException - if a JSONArray is instead available
    • getArrayResult

      public JSONArray getArrayResult() throws JSONException
      Fetch the JSONArray parsed from the response. If the value parsed is a JSONObject, return a JSONArray with the JSONObject as its only element.
      Returns:
      the JSONArray parsed from the response
      Throws:
      JSONException - if the JSONArray is null