public static class VolleyUtil.RequestParams
extends java.lang.Object
VolleyUtil.RequestParams
is a class used to pass in to Volley requests
that is used set provided values against the request. The following
values are required for request parameters:
1. Method type (eg. GET, POST). 2. UrlThe following values can optionally be set on the request (through the parameters):
1. Headers - headers to include in the request. 2. Parameters - parameters to include in the body of PUT or POST requests. 3. Cache key - unique entry used to compare cached responses (by default the url of the request is used). 4. Retry policy - policy used to retry the request in the event of network failure. 5. Body content type - the type of content contained in the body for PUT or POST requests. 6. Body - the body for PUT or POST requests (will override Parameters if set).Note: The cache key should be overridden if the request url is not appropriate for a unique key. For example, if the request includes a timestamp (or nonce) that does not affect the response, the url would be different for repeat requests, hence any cached value will be ignored. For example, the following url could use the following as a cache key:
url: http://www.example.com/details?page=1&count=10×tamp=123456789&user=1234 cache key: http://www.example.com/details?count=10&page=1&user=1234 // parameters ordered alphabetically
Constructor and Description |
---|
RequestParams(int method,
java.lang.String url) |
Modifier and Type | Method and Description |
---|---|
void |
addHeader(java.lang.String key,
java.lang.String value) |
void |
addParam(java.lang.String key,
java.lang.String value) |
byte[] |
getBody() |
java.lang.String |
getBodyContentType() |
java.lang.String |
getCacheKey() |
java.util.Map<java.lang.String,java.lang.String> |
getHeaders() |
int |
getMethod() |
java.util.Map<java.lang.String,java.lang.String> |
getParams() |
com.android.volley.RetryPolicy |
getRetryPolicy() |
java.lang.String |
getUrl() |
boolean |
isUseCache() |
void |
setBody(byte[] body) |
void |
setBodyContentType(java.lang.String contentType) |
void |
setCacheKey(java.lang.String key) |
void |
setHeaders(java.util.Map<java.lang.String,java.lang.String> headers) |
void |
setParams(java.util.Map<java.lang.String,java.lang.String> params) |
void |
setRetryPolicy(com.android.volley.RetryPolicy policy) |
void |
setUseCache(boolean cache) |
public int getMethod()
public java.lang.String getUrl()
public void setRetryPolicy(com.android.volley.RetryPolicy policy)
public com.android.volley.RetryPolicy getRetryPolicy()
public void setUseCache(boolean cache)
public boolean isUseCache()
public void addHeader(java.lang.String key, java.lang.String value)
public void setHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
public java.util.Map<java.lang.String,java.lang.String> getHeaders()
public void addParam(java.lang.String key, java.lang.String value)
public void setParams(java.util.Map<java.lang.String,java.lang.String> params)
public java.util.Map<java.lang.String,java.lang.String> getParams()
public void setCacheKey(java.lang.String key)
public java.lang.String getCacheKey()
public java.lang.String getBodyContentType()
public void setBodyContentType(java.lang.String contentType)
public byte[] getBody()
public void setBody(byte[] body)