public class MockRequest extends Request<byte[]>
Request.Method, Request.Priority
Modifier and Type | Field and Description |
---|---|
boolean |
cancel_called |
boolean |
deliverError_called |
boolean |
deliverResponse_called |
boolean |
parseResponse_called |
Constructor and Description |
---|
MockRequest() |
MockRequest(String url,
Response.ErrorListener listener) |
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Mark this request as canceled.
|
void |
deliverError(VolleyError error)
Delivers error message to the ErrorListener that the Request was
initialized with.
|
protected void |
deliverResponse(byte[] response)
Subclasses must implement this to perform delivery of the parsed
response to their listeners.
|
String |
getCacheKey()
Returns the cache key for this request.
|
Map<String,String> |
getPostParams()
Returns a Map of POST parameters to be used for this request, or null if
a simple GET should be used.
|
Request.Priority |
getPriority()
Returns the
Request.Priority of this request; Request.Priority.NORMAL by default. |
protected Response<byte[]> |
parseNetworkResponse(NetworkResponse response)
Subclasses must implement this to parse the raw network response
and return an appropriate response type.
|
void |
setCacheKey(String cacheKey) |
void |
setPostParams(Map<String,String> postParams) |
void |
setPriority(Request.Priority priority) |
addMarker, compareTo, getBody, getBodyContentType, getCacheEntry, getErrorListener, getHeaders, getMethod, getParams, getParamsEncoding, getPostBody, getPostBodyContentType, getPostParamsEncoding, getRetryPolicy, getSequence, getTag, getTimeoutMs, getTrafficStatsTag, getUrl, hasHadResponseDelivered, isCanceled, markDelivered, parseNetworkError, setCacheEntry, setRequestQueue, setRetryPolicy, setSequence, setShouldCache, setTag, shouldCache, toString
public boolean deliverResponse_called
public boolean parseResponse_called
public boolean deliverError_called
public boolean cancel_called
public MockRequest()
public MockRequest(String url, Response.ErrorListener listener)
public Map<String,String> getPostParams()
Request
AuthFailureError
as
authentication may be required to provide these values.
Note that only one of getPostParams() and getPostBody() can return a non-null value.
getPostParams
in class Request<byte[]>
public void setCacheKey(String cacheKey)
public String getCacheKey()
Request
getCacheKey
in class Request<byte[]>
protected void deliverResponse(byte[] response)
Request
deliverResponse
in class Request<byte[]>
response
- The parsed response returned by
Request.parseNetworkResponse(NetworkResponse)
public void deliverError(VolleyError error)
Request
deliverError
in class Request<byte[]>
error
- Error detailspublic void cancel()
Request
public void setPriority(Request.Priority priority)
public Request.Priority getPriority()
Request
Request.Priority
of this request; Request.Priority.NORMAL
by default.getPriority
in class Request<byte[]>
protected Response<byte[]> parseNetworkResponse(NetworkResponse response)
Request
parseNetworkResponse
in class Request<byte[]>
response
- Response from the network