com.android.volley
クラス Request<T>

java.lang.Object
  上位を拡張 com.android.volley.Request<T>
型パラメータ:
T - The type of parsed response this request expects.
すべての実装されたインタフェース:
java.lang.Comparable<Request<T>>
直系の既知のサブクラス:
ClearCacheRequest, ImageRequest, JsonRequest, StringRequest

public abstract class Request<T>
extends java.lang.Object
implements java.lang.Comparable<Request<T>>

Base class for all network requests.


入れ子のクラスの概要
static interface Request.Method
          Supported request methods.
static class Request.Priority
          Priority values.
 
コンストラクタの概要
Request(int method, java.lang.String url, Response.ErrorListener listener)
          Creates a new request with the given method (one of the values from Request.Method), URL, and error listener.
Request(java.lang.String url, Response.ErrorListener listener)
          推奨されていません。 Use Request(int, String, com.android.volley.Response.ErrorListener).
 
メソッドの概要
 void addMarker(java.lang.String tag)
          Adds an event to this request's event log; for debugging.
 void cancel()
          Mark this request as canceled.
 int compareTo(Request<T> other)
          Our comparator sorts from high to low priority, and secondarily by sequence number to provide FIFO ordering.
 void deliverError(VolleyError error)
          Delivers error message to the ErrorListener that the Request was initialized with.
 byte[] getBody()
          Returns the raw POST or PUT body to be sent.
 java.lang.String getBodyContentType()
           
 Cache.Entry getCacheEntry()
          Returns the annotated cache entry, or null if there isn't one.
 java.lang.String getCacheKey()
          Returns the cache key for this request.
 java.util.Map<java.lang.String,java.lang.String> getHeaders()
          Returns a list of extra HTTP headers to go along with this request.
 int getMethod()
          Return the method for this request.
 byte[] getPostBody()
          推奨されていません。 Use getBody() instead.
 java.lang.String getPostBodyContentType()
          推奨されていません。 Use getBodyContentType() instead.
 Request.Priority getPriority()
          Returns the Request.Priority of this request; Request.Priority.NORMAL by default.
 RetryPolicy getRetryPolicy()
          Returns the retry policy that should be used for this request.
 int getSequence()
          Returns the sequence number of this request.
 java.lang.Object getTag()
          Returns this request's tag.
 int getTimeoutMs()
          Returns the socket timeout in milliseconds per retry attempt.
 int getTrafficStatsTag()
           
 java.lang.String getUrl()
          Returns the URL of this request.
 boolean hasHadResponseDelivered()
          Returns true if this request has had a response delivered for it.
 boolean isCanceled()
          Returns true if this request has been canceled.
 void markDelivered()
          Mark this request as having a response delivered on it.
 void setCacheEntry(Cache.Entry entry)
          Annotates this request with an entry retrieved for it from cache.
 void setRequestQueue(RequestQueue requestQueue)
          Associates this request with the given queue.
 void setRetryPolicy(RetryPolicy retryPolicy)
          Sets the retry policy for this request.
 void setSequence(int sequence)
          Sets the sequence number of this request.
 void setShouldCache(boolean shouldCache)
          Set whether or not responses to this request should be cached.
 void setTag(java.lang.Object tag)
          Set a tag on this request.
 boolean shouldCache()
          Returns true if responses to this request should be cached.
 java.lang.String toString()
           
 
クラス java.lang.Object から継承されたメソッド
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

コンストラクタの詳細

Request

public Request(java.lang.String url,
               Response.ErrorListener listener)
推奨されていません。 Use Request(int, String, com.android.volley.Response.ErrorListener).

Creates a new request with the given URL and error listener. Note that the normal response listener is not provided here as delivery of responses is provided by subclasses, who have a better idea of how to deliver an already-parsed response.


Request

public Request(int method,
               java.lang.String url,
               Response.ErrorListener listener)
Creates a new request with the given method (one of the values from Request.Method), URL, and error listener. Note that the normal response listener is not provided here as delivery of responses is provided by subclasses, who have a better idea of how to deliver an already-parsed response.

メソッドの詳細

getMethod

public int getMethod()
Return the method for this request. Can be one of the values in Request.Method.


setTag

public void setTag(java.lang.Object tag)
Set a tag on this request. Can be used to cancel all requests with this tag by RequestQueue.cancelAll(Object).


getTag

public java.lang.Object getTag()
Returns this request's tag.

関連項目:
setTag(Object)

getTrafficStatsTag

public int getTrafficStatsTag()
戻り値:
A tag for use with TrafficStats#setThreadStatsTag(int)

setRetryPolicy

public void setRetryPolicy(RetryPolicy retryPolicy)
Sets the retry policy for this request.


addMarker

public void addMarker(java.lang.String tag)
Adds an event to this request's event log; for debugging.


setRequestQueue

public void setRequestQueue(RequestQueue requestQueue)
Associates this request with the given queue. The request queue will be notified when this request has finished.


setSequence

public final void setSequence(int sequence)
Sets the sequence number of this request. Used by RequestQueue.


getSequence

public final int getSequence()
Returns the sequence number of this request.


getUrl

public java.lang.String getUrl()
Returns the URL of this request.


getCacheKey

public java.lang.String getCacheKey()
Returns the cache key for this request. By default, this is the URL.


setCacheEntry

public void setCacheEntry(Cache.Entry entry)
Annotates this request with an entry retrieved for it from cache. Used for cache coherency support.


getCacheEntry

public Cache.Entry getCacheEntry()
Returns the annotated cache entry, or null if there isn't one.


cancel

public void cancel()
Mark this request as canceled. No callback will be delivered.


isCanceled

public boolean isCanceled()
Returns true if this request has been canceled.


getHeaders

public java.util.Map<java.lang.String,java.lang.String> getHeaders()
                                                            throws AuthFailureError
Returns a list of extra HTTP headers to go along with this request. Can throw AuthFailureError as authentication may be required to provide these values.

例外:
AuthFailureError - In the event of auth failure

getPostBodyContentType

public java.lang.String getPostBodyContentType()
推奨されていません。 Use getBodyContentType() instead.


getPostBody

public byte[] getPostBody()
                   throws AuthFailureError
推奨されていません。 Use getBody() instead.

Returns the raw POST body to be sent.

例外:
AuthFailureError - In the event of auth failure

getBodyContentType

public java.lang.String getBodyContentType()

getBody

public byte[] getBody()
               throws AuthFailureError
Returns the raw POST or PUT body to be sent.

例外:
AuthFailureError - in the event of auth failure

setShouldCache

public final void setShouldCache(boolean shouldCache)
Set whether or not responses to this request should be cached.


shouldCache

public final boolean shouldCache()
Returns true if responses to this request should be cached.


getPriority

public Request.Priority getPriority()
Returns the Request.Priority of this request; Request.Priority.NORMAL by default.


getTimeoutMs

public final int getTimeoutMs()
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 TimeoutError error.


getRetryPolicy

public RetryPolicy getRetryPolicy()
Returns the retry policy that should be used for this request.


markDelivered

public void markDelivered()
Mark this request as having a response delivered on it. This can be used later in the request's lifetime for suppressing identical responses.


hasHadResponseDelivered

public boolean hasHadResponseDelivered()
Returns true if this request has had a response delivered for it.


deliverError

public void deliverError(VolleyError error)
Delivers error message to the ErrorListener that the Request was initialized with.

パラメータ:
error - Error details

compareTo

public int compareTo(Request<T> other)
Our comparator sorts from high to low priority, and secondarily by sequence number to provide FIFO ordering.

定義:
インタフェース java.lang.Comparable<Request<T>> 内の compareTo

toString

public java.lang.String toString()
オーバーライド:
クラス java.lang.Object 内の toString