com.duowan.mobile.netroid.request
Class StringRequest

java.lang.Object
  extended by com.duowan.mobile.netroid.Request<java.lang.String>
      extended by com.duowan.mobile.netroid.request.StringRequest
All Implemented Interfaces:
java.lang.Comparable<Request<java.lang.String>>

public class StringRequest
extends Request<java.lang.String>

A canned request for retrieving the response body at a given URL as a String.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.duowan.mobile.netroid.Request
Request.Method, Request.Priority
 
Constructor Summary
StringRequest(int method, java.lang.String url, Listener<java.lang.String> listener)
          Creates a new request with the given method.
StringRequest(java.lang.String url, Listener<java.lang.String> listener)
          Creates a new GET request.
 
Method Summary
protected  Response<java.lang.String> parseNetworkResponse(NetworkResponse response)
          Subclasses must implement this to parse the raw network response and return an appropriate response type.
 
Methods inherited from class com.duowan.mobile.netroid.Request
addHeader, addMarker, cancel, compareTo, deliverCancel, deliverDownloadProgress, deliverError, deliverFinish, deliverNetworking, deliverPreExecute, deliverRetry, deliverSuccess, deliverUsedCache, finish, getBody, getBodyContentType, getCacheExpireTime, getCacheKey, getHeaders, getMethod, getParams, getParamsEncoding, getPriority, getRetryPolicy, getSequence, getTag, getTimeoutMs, getUrl, handleResponse, hasHadResponseDelivered, isCanceled, isForceUpdate, markDelivered, parseNetworkError, perform, prepare, removeHeader, setCacheExpireTime, setForceUpdate, setListener, setRequestQueue, setRetryPolicy, setSequence, setTag, shouldCache, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringRequest

public StringRequest(int method,
                     java.lang.String url,
                     Listener<java.lang.String> listener)
Creates a new request with the given method.

Parameters:
method - the request Method to use
url - URL to fetch the string at
listener - Listener to receive the String response or error message

StringRequest

public StringRequest(java.lang.String url,
                     Listener<java.lang.String> listener)
Creates a new GET request.

Parameters:
url - URL to fetch the string at
listener - Listener to receive the String response
Method Detail

parseNetworkResponse

protected Response<java.lang.String> parseNetworkResponse(NetworkResponse response)
Description copied from class: Request
Subclasses must implement this to parse the raw network response and return an appropriate response type. This method will be called from a worker thread. The response will not be delivered if you return null.

Specified by:
parseNetworkResponse in class Request<java.lang.String>
Parameters:
response - Response from the network
Returns:
The parsed response, or null in the case of an error