java.lang.Object | ||
↳ | com.neomades.content.Query | |
↳ | com.neomades.content.ContentQuery |
![]() |
ContentQuery
is a webservice query.
ContentQuery
can be sent to network using
Screen.postQuery(Query)
or
postQuery(Query)
.
An instance of ContentQuery
can be used only once.
DefaultRetryPolicy
is the RetryPolicy
set by default for a new ContentQuery
.
To download big data, do not use ContentQuery
. Prefer using
HttpRequest
and getDataStream()
.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ContentQuery(int method, String url)
Creates a new query with the given method (one of the values from
Method ), and URL. |
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ContentQuery() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
cancel()
Cancels this query.
| ||||||||||
CacheEntry |
getCacheEntry()
Returns the annotated cache entry, or null if there isn't one.
| ||||||||||
String |
getCacheKey()
Returns the cache key for this request.
| ||||||||||
String |
getContentResponseType()
Returns the
ContentResponse type. | ||||||||||
final int |
getMethod()
Returns the method for this request.
| ||||||||||
int | getPriority() | ||||||||||
RetryPolicy |
getRetryPolicy()
Returns the retry policy that should be used for this request.
| ||||||||||
final Object | getTag() | ||||||||||
final int |
getTimeoutMs()
Returns the socket timeout in milliseconds per retry attempt.
| ||||||||||
String |
getUrl()
Returns the URL of this request.
| ||||||||||
boolean |
hasHadResponseDelivered()
Returns true if this request has had a response delivered for it.
| ||||||||||
final boolean | isCanceled() | ||||||||||
void |
setCache(Cache cache)
Sets the
Cache to use with this query (if the query
shouldCache() ) | ||||||||||
void |
setCacheEntry(CacheEntry entry)
Annotates this request with an entry retrieved for it from cache.
| ||||||||||
void |
setCacheType(String cacheType)
Sets the type of
Cache to use from ContentManager . | ||||||||||
void |
setContentManager(ContentManager manager)
Sets the
ContentManager | ||||||||||
void |
setContentResponseType(String responseType)
Sets the ContentResponse type when the query has had response delivered.
| ||||||||||
void |
setHeaders(Map<String, String> headers)
Sets a list of extra HTTP headers to go along with this query.
| ||||||||||
void |
setNetwork(Network network)
Sets the
Network to use with this query. | ||||||||||
void |
setNetworkType(String networkType)
Sets the type of
Network to use from ContentManager . | ||||||||||
void |
setParameter(Object parameter)
Sets a model Object to serialize through a
Parser . | ||||||||||
void |
setParameterParser(Parser parser)
Set the
Parser instance to use for serializing parameter. | ||||||||||
void |
setParameterParserType(String parameterParserType)
Set the type of
Parser to use for serializing parameter. | ||||||||||
void |
setPriority(int priority)
Returns this query priority.
| ||||||||||
void |
setResponseParser(Parser responseParserType)
Sets the parser for reading network data.
| ||||||||||
void |
setResponseParserType(String responseParserType)
Sets the response data
Parser type. | ||||||||||
void |
setRetryPolicy(RetryPolicy policy)
Sets the RetryPolicy to use with this query.
| ||||||||||
void |
setRetryPolicyType(String retryPolicy)
Sets the type of
RetryPolicy to use from ContentManager . | ||||||||||
final void |
setShouldCache(boolean shouldCache)
Set whether or not responses to this request should be cached.
| ||||||||||
void | setTag(Object tag) | ||||||||||
void |
setUrlParams(Map<String, String> urlParams)
Sets a list of URL parameters (key-value table).
| ||||||||||
final boolean |
shouldCache()
Returns true if responses to this request should be cached.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
final void |
onExecute()
Internal method.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Cancels this query. If the query was waiting in the queue, it will be removed from the waiting queue.
To cancel a Query through the EventBus
, a special query exists:
CancelQuery
.
Returns the annotated cache entry, or null if there isn't one.
If the query has delivered a response from cache, this methods will return the associated cache entry.
Returns the cache key for this request. By default, this is the URL.
Returns the retry policy that should be used for this request.
Returns the socket timeout in milliseconds per retry attempt. (This value can
be changed per retry attempt if a backoff is specified via backoffTimeout()).
If there are no retry attempts remaining, this will cause delivery of a
Error
timeout error.
Returns true if this request has had a response delivered for it.
Sets the Cache
to use with this query (if the query
shouldCache()
)
cache | a cache instance |
---|
Annotates this request with an entry retrieved for it from cache. Used for cache coherency support.
This method is used by Cache.
entry | a cache entry |
---|
Sets the type of Cache
to use from ContentManager
.
cacheType | type of Cache from ContentManager |
---|
Sets the ContentManager
manager | a ContentManager instance. |
---|
Sets the ContentResponse type when the query has had response delivered.
Useful to differentiate many content responses.
responseType | type of response |
---|
Sets a list of extra HTTP headers to go along with this query.
headers | HTTP headers |
---|
Sets the Network
to use with this query.
network | a Network instance |
---|
Sets the type of Network
to use from ContentManager
.
networkType | type of Network from ContentManager |
---|
Sets a model Object to serialize through a Parser
.
parameter | the object to serialize before executing query. |
---|
Set the Parser
instance to use for serializing parameter.
parser | the parser to use |
---|
Set the type of Parser
to use for serializing parameter.
Different types of Parser
are registered by
ContentManager
.
parameterParserType | type of Parser |
---|
Sets the parser for reading network data.
responseParserType | the parser to use for reading network data |
---|
Sets the response data Parser
type.
Different types of Parser
are registered by
ContentManager
.
responseParserType | the parser to use for reading network data |
---|
Sets the RetryPolicy to use with this query.
policy | a retry policy instance |
---|
Sets the type of RetryPolicy
to use from ContentManager
.
retryPolicy | type of RetryPolicy from ContentManager |
---|
Set whether or not responses to this request should be cached.
shouldCache | true if the query should be cached. |
---|
Sets a list of URL parameters (key-value table). Theses URL params will be
appended to the URL like ¶mName=paramValue
.
urlParams | URL parameters. |
---|
Returns true if responses to this request should be cached.
Internal method.