AGJSONHandler (agraph-java-client 5.0.4-SNAPSHOT API)
Description: declaration: package: com.franz.agraph.http.handler, class: AGJSONHandler

Package com.franz.agraph.http.handler

# Class AGJSONHandler

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

public class AGJSONHandler extends AGResponseHandler

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AGJSONHandler()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `JSONArray`
  `getArrayResult()`
  Fetch the JSONArray parsed from the response.
  `JSONObject`
  `getResult()`
  `void`
  `handleResponse(org.apache.http.HttpResponse httpResponse, HttpUriRequest httpUriRequest)`
  Parse http response as a JSON object.

  ### Methods inherited from class com.franz.agraph.http.handler.AGResponseHandler

  `getRequestMIMEType, releaseConnection`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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