FileDocCategorySizeDatePackage
JsonRequest.javaAPI DocAndroid 5.1 API3311Thu Mar 12 22:22:56 GMT 2015com.android.volley.toolbox

JsonRequest

public abstract class JsonRequest extends com.android.volley.Request
A request for retrieving a T type response body at a given URL that also optionally sends along a JSON body in the request specified.
param
JSON type of response expected

Fields Summary
private static final String
PROTOCOL_CHARSET
Charset for request.
private static final String
PROTOCOL_CONTENT_TYPE
Content type for request.
private final com.android.volley.Response.Listener
mListener
private final String
mRequestBody
Constructors Summary
public JsonRequest(String url, String requestBody, com.android.volley.Response.Listener listener, com.android.volley.Response.ErrorListener errorListener)
Deprecated constructor for a JsonRequest which defaults to GET unless {@link #getPostBody()} or {@link #getPostParams()} is overridden (which defaults to POST).

deprecated
Use {@link #JsonRequest(int, String, String, Listener, ErrorListener)}.


                                      
          
              
        this(Method.DEPRECATED_GET_OR_POST, url, requestBody, listener, errorListener);
    
public JsonRequest(int method, String url, String requestBody, com.android.volley.Response.Listener listener, com.android.volley.Response.ErrorListener errorListener)

        super(method, url, errorListener);
        mListener = listener;
        mRequestBody = requestBody;
    
Methods Summary
protected voiddeliverResponse(T response)

        mListener.onResponse(response);
    
public byte[]getBody()

        try {
            return mRequestBody == null ? null : mRequestBody.getBytes(PROTOCOL_CHARSET);
        } catch (UnsupportedEncodingException uee) {
            VolleyLog.wtf("Unsupported Encoding while trying to get the bytes of %s using %s",
                    mRequestBody, PROTOCOL_CHARSET);
            return null;
        }
    
public java.lang.StringgetBodyContentType()

        return PROTOCOL_CONTENT_TYPE;
    
public byte[]getPostBody()

deprecated
Use {@link #getBody()}.

        return getBody();
    
public java.lang.StringgetPostBodyContentType()

deprecated
Use {@link #getBodyContentType()}.

        return getBodyContentType();
    
protected abstract com.android.volley.ResponseparseNetworkResponse(com.android.volley.NetworkResponse response)