Package com.franz.agraph.http.handler
Class AGJSONHandler
java.lang.Object
com.franz.agraph.http.handler.AGResponseHandler
com.franz.agraph.http.handler.AGJSONHandler
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionFetch the JSONArray parsed from the response.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
-
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 classAGResponseHandler
- Throws:
IOException
AGHttpException
-
getResult
- Returns:
- the JSONObject parsed from the response
- Throws:
JSONException
- if a JSONArray is instead available
-
getArrayResult
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
-