JsonObjectRequestpublic class JsonObjectRequest extends JsonRequest A request for retrieving a {@link JSONObject} response body at a given URL, allowing for an
optional {@link JSONObject} to be passed in as part of the request body. |
Constructors Summary |
---|
public JsonObjectRequest(int method, String url, JSONObject jsonRequest, com.android.volley.Response.Listener listener, com.android.volley.Response.ErrorListener errorListener)Creates a new request.
super(method, url, (jsonRequest == null) ? null : jsonRequest.toString(), listener,
errorListener);
| public JsonObjectRequest(String url, JSONObject jsonRequest, com.android.volley.Response.Listener listener, com.android.volley.Response.ErrorListener errorListener)Constructor which defaults to GET if jsonRequest is
null , POST otherwise.
this(jsonRequest == null ? Method.GET : Method.POST, url, jsonRequest,
listener, errorListener);
|
Methods Summary |
---|
protected com.android.volley.Response | parseNetworkResponse(com.android.volley.NetworkResponse response)
try {
String jsonString =
new String(response.data, HttpHeaderParser.parseCharset(response.headers));
return Response.success(new JSONObject(jsonString),
HttpHeaderParser.parseCacheHeaders(response));
} catch (UnsupportedEncodingException e) {
return Response.error(new ParseError(e));
} catch (JSONException je) {
return Response.error(new ParseError(je));
}
|
|