类 GsonRequest<Q,R>

java.lang.Object
com.android.volley.Request<R>
net.apexes.commons.volley.GsonRequest<Q,R>
类型参数:
Q - Request数据类型
R - Response数据类型
所有已实现的接口:
Comparable<Request<R>>

public class GsonRequest<Q,R> extends Request<R>
作者:
HeDYn
  • 字段详细资料

  • 构造器详细资料

    • GsonRequest

      public GsonRequest(String url, Q requestObject, Type responseType, Response.Listener<R> listener, Response.ErrorListener errorListener)
      参数:
      url -
      requestObject - 要POST的数据
      responseType - Response数据要转成的对象类型
      listener -
      errorListener -
    • GsonRequest

      public GsonRequest(String url, Q requestObject, Type responseType, com.google.gson.Gson gson, Response.Listener<R> listener, Response.ErrorListener errorListener)
      参数:
      url -
      requestObject - 要POST的数据
      responseType - Response数据要转成的对象类型
      gson -
      listener -
      errorListener -
  • 方法详细资料

    • getBodyContentType

      public String getBodyContentType()
      从类复制的说明: Request
      Returns the content type of the POST or PUT body.
      覆盖:
      getBodyContentType 在类中 Request<R>
    • getBody

      public byte[] getBody() throws AuthFailureError
      从类复制的说明: Request
      Returns the raw POST or PUT body to be sent.

      By default, the body consists of the request parameters in application/x-www-form-urlencoded format. When overriding this method, consider overriding Request.getBodyContentType() as well to match the new body format.

      覆盖:
      getBody 在类中 Request<R>
      抛出:
      AuthFailureError - in the event of auth failure
    • deliverResponse

      protected void deliverResponse(R response)
      从类复制的说明: Request
      Subclasses must implement this to perform delivery of the parsed response to their listeners. The given response is guaranteed to be non-null; responses that fail to parse are not delivered.
      指定者:
      deliverResponse 在类中 Request<R>
      参数:
      response - The parsed response returned by Request.parseNetworkResponse(NetworkResponse)
    • parseNetworkResponse

      protected Response<R> parseNetworkResponse(NetworkResponse response)
      从类复制的说明: 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.
      指定者:
      parseNetworkResponse 在类中 Request<R>
      参数:
      response - Response from the network
      返回:
      The parsed response, or null in the case of an error
    • toResponseValue

      protected R toResponseValue(String json, Type responseType) throws Exception
      抛出:
      Exception
    • setResponseProcessor

      public void setResponseProcessor(GsonRequest.ResponseProcessor<R> processor)