com.android.volley.Request.encodeParameters()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(11.9k)|赞(0)|评价(0)|浏览(104)

本文整理了Java中com.android.volley.Request.encodeParameters方法的一些代码示例,展示了Request.encodeParameters的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.encodeParameters方法的具体详情如下:
包路径:com.android.volley.Request
类名称:Request
方法名:encodeParameters

Request.encodeParameters介绍

[英]Converts params into an application/x-www-form-urlencoded encoded string.
[中]将params转换为应用程序/x-www-form-urlencoded字符串。

代码示例

代码示例来源:origin: chentao0707/SimplifyReader

/**
 * Returns the raw POST body to be sent.
 *
 * @throws AuthFailureError In the event of auth failure
 *
 * @deprecated Use {@link #getBody()} instead.
 */
@Deprecated
public byte[] getPostBody() throws AuthFailureError {
  // Note: For compatibility with legacy clients of volley, this implementation must remain
  // here instead of simply calling the getBody() function because this function must
  // call getPostParams() and getPostParamsEncoding() since legacy clients would have
  // overridden these two member functions for POST requests.
  Map<String, String> postParams = getPostParams();
  if (postParams != null && postParams.size() > 0) {
    return encodeParameters(postParams, getPostParamsEncoding());
  }
  return null;
}

代码示例来源:origin: mcxiaoke/android-volley

/**
 * Returns the raw POST or PUT body to be sent.
 *
 * <p>By default, the body consists of the request parameters in
 * application/x-www-form-urlencoded format. When overriding this method, consider overriding
 * {@link #getBodyContentType()} as well to match the new body format.
 *
 * @throws AuthFailureError in the event of auth failure
 */
public byte[] getBody() throws AuthFailureError {
  Map<String, String> params = getParams();
  if (params != null && params.size() > 0) {
    return encodeParameters(params, getParamsEncoding());
  }
  return null;
}

代码示例来源:origin: chentao0707/SimplifyReader

/**
 * Returns the raw POST or PUT body to be sent.
 *
 * <p>By default, the body consists of the request parameters in
 * application/x-www-form-urlencoded format. When overriding this method, consider overriding
 * {@link #getBodyContentType()} as well to match the new body format.
 *
 * @throws AuthFailureError in the event of auth failure
 */
public byte[] getBody() throws AuthFailureError {
  Map<String, String> params = getParams();
  if (params != null && params.size() > 0) {
    return encodeParameters(params, getParamsEncoding());
  }
  return null;
}

代码示例来源:origin: mcxiaoke/android-volley

/**
 * Returns the raw POST body to be sent.
 *
 * @throws AuthFailureError In the event of auth failure
 *
 * @deprecated Use {@link #getBody()} instead.
 */
@Deprecated
public byte[] getPostBody() throws AuthFailureError {
  // Note: For compatibility with legacy clients of volley, this implementation must remain
  // here instead of simply calling the getBody() function because this function must
  // call getPostParams() and getPostParamsEncoding() since legacy clients would have
  // overridden these two member functions for POST requests.
  Map<String, String> postParams = getPostParams();
  if (postParams != null && postParams.size() > 0) {
    return encodeParameters(postParams, getPostParamsEncoding());
  }
  return null;
}

代码示例来源:origin: jiangqqlmj/FastDev4Android

/**
 * Returns the raw POST body to be sent.
 *
 * @throws AuthFailureError In the event of auth failure
 *
 * @deprecated Use {@link #getBody()} instead.
 */
@Deprecated
public byte[] getPostBody() throws AuthFailureError {
  // Note: For compatibility with legacy clients of volley, this implementation must remain
  // here instead of simply calling the getBody() function because this function must
  // call getPostParams() and getPostParamsEncoding() since legacy clients would have
  // overridden these two member functions for POST requests.
  Map<String, String> postParams = getPostParams();
  if (postParams != null && postParams.size() > 0) {
    return encodeParameters(postParams, getPostParamsEncoding());
  }
  return null;
}

代码示例来源:origin: jiangqqlmj/FastDev4Android

/**
 * Returns the raw POST or PUT body to be sent.
 * 如果请求是POST或者PUT方法,去获取请求参数信息,然后设置到请求中
 * <p>By default, the body consists of the request parameters in
 * application/x-www-form-urlencoded format. When overriding this method, consider overriding
 * {@link #getBodyContentType()} as well to match the new body format.
 *
 * @throws AuthFailureError in the event of auth failure
 */
public byte[] getBody() throws AuthFailureError {
  //获取请求参数信息
  Map<String, String> params = getParams();
  if (params != null && params.size() > 0) {
    return encodeParameters(params, getParamsEncoding());
  }
  return null;
}

代码示例来源:origin: xuningjack/AndroidNet

/**
 * Returns the raw POST or PUT body to be sent.
 *
 * @throws AuthFailureError in the event of auth failure
 */
public byte[] getBody() throws AuthFailureError {
  Map<String, String> params = getParams();
  if (params != null && params.size() > 0) {
    return encodeParameters(params, getParamsEncoding());
  }
  return null;
}

代码示例来源:origin: xuningjack/AndroidNet

/**
 * Returns the raw POST body to be sent.
 *
 * @throws AuthFailureError In the event of auth failure
 *
 * @deprecated Use {@link #getBody()} instead.
 */
@Deprecated
public byte[] getPostBody() throws AuthFailureError {
  // Note: For compatibility with legacy clients of volley, this implementation must remain
  // here instead of simply calling the getBody() function because this function must
  // call getPostParams() and getPostParamsEncoding() since legacy clients would have
  // overridden these two member functions for POST requests.
  Map<String, String> postParams = getPostParams();
  if (postParams != null && postParams.size() > 0) {
    return encodeParameters(postParams, getPostParamsEncoding());
  }
  return null;
}

代码示例来源:origin: MewX/light-novel-library_Wenku8_Android

/**
 * Returns the raw POST or PUT body to be sent.
 *
 * <p>By default, the body consists of the request parameters in
 * application/x-www-form-urlencoded format. When overriding this method, consider overriding
 * {@link #getBodyContentType()} as well to match the new body format.
 *
 * @throws AuthFailureError in the event of auth failure
 */
public byte[] getBody() throws AuthFailureError {
  Map<String, String> params = getParams();
  if (params != null && params.size() > 0) {
    return encodeParameters(params, getParamsEncoding());
  }
  return null;
}

代码示例来源:origin: com.mcxiaoke.volley/library

/**
 * Returns the raw POST body to be sent.
 *
 * @throws AuthFailureError In the event of auth failure
 *
 * @deprecated Use {@link #getBody()} instead.
 */
@Deprecated
public byte[] getPostBody() throws AuthFailureError {
  // Note: For compatibility with legacy clients of volley, this implementation must remain
  // here instead of simply calling the getBody() function because this function must
  // call getPostParams() and getPostParamsEncoding() since legacy clients would have
  // overridden these two member functions for POST requests.
  Map<String, String> postParams = getPostParams();
  if (postParams != null && postParams.size() > 0) {
    return encodeParameters(postParams, getPostParamsEncoding());
  }
  return null;
}

代码示例来源:origin: com.mcxiaoke.volley/library

/**
 * Returns the raw POST or PUT body to be sent.
 *
 * <p>By default, the body consists of the request parameters in
 * application/x-www-form-urlencoded format. When overriding this method, consider overriding
 * {@link #getBodyContentType()} as well to match the new body format.
 *
 * @throws AuthFailureError in the event of auth failure
 */
public byte[] getBody() throws AuthFailureError {
  Map<String, String> params = getParams();
  if (params != null && params.size() > 0) {
    return encodeParameters(params, getParamsEncoding());
  }
  return null;
}

代码示例来源:origin: tazimete/android-app-food-delivery-system

/**
 * Returns the raw POST body to be sent.
 *
 * @throws AuthFailureError In the event of auth failure
 *
 * @deprecated Use {@link #getBody()} instead.
 */
@Deprecated
public byte[] getPostBody() throws AuthFailureError {
  // Note: For compatibility with legacy clients of volley, this implementation must remain
  // here instead of simply calling the getBody() function because this function must
  // call getPostParams() and getPostParamsEncoding() since legacy clients would have
  // overridden these two member functions for POST requests.
  Map<String, String> postParams = getPostParams();
  if (postParams != null && postParams.size() > 0) {
    return encodeParameters(postParams, getPostParamsEncoding());
  }
  return null;
}

代码示例来源:origin: MewX/light-novel-library_Wenku8_Android

/**
 * Returns the raw POST body to be sent.
 *
 * @throws AuthFailureError In the event of auth failure
 *
 * @deprecated Use {@link #getBody()} instead.
 */
@Deprecated
public byte[] getPostBody() throws AuthFailureError {
  // Note: For compatibility with legacy clients of volley, this implementation must remain
  // here instead of simply calling the getBody() function because this function must
  // call getPostParams() and getPostParamsEncoding() since legacy clients would have
  // overridden these two member functions for POST requests.
  Map<String, String> postParams = getPostParams();
  if (postParams != null && postParams.size() > 0) {
    return encodeParameters(postParams, getPostParamsEncoding());
  }
  return null;
}

代码示例来源:origin: panxw/android-volley-manager

/**
 * Returns the raw POST or PUT body to be sent.
 *
 * <p>By default, the body consists of the request parameters in
 * application/x-www-form-urlencoded format. When overriding this method, consider overriding
 * {@link #getBodyContentType()} as well to match the new body format.
 *
 * @throws AuthFailureError in the event of auth failure
 */
public byte[] getBody() throws AuthFailureError {
  Map<String, String> params = getParams();
  if (params != null && params.size() > 0) {
    return encodeParameters(params, getParamsEncoding());
  }
  return null;
}

代码示例来源:origin: tazimete/android-app-food-delivery-system

/**
 * Returns the raw POST or PUT body to be sent.
 *
 * <p>By default, the body consists of the request parameters in
 * application/x-www-form-urlencoded format. When overriding this method, consider overriding
 * {@link #getBodyContentType()} as well to match the new body format.
 *
 * @throws AuthFailureError in the event of auth failure
 */
public byte[] getBody() throws AuthFailureError {
  Map<String, String> params = getParams();
  if (params != null && params.size() > 0) {
    return encodeParameters(params, getParamsEncoding());
  }
  return null;
}

代码示例来源:origin: tazimete/android-app-food-delivery-system

/**
 * Returns the raw POST or PUT body to be sent.
 *
 * <p>By default, the body consists of the request parameters in
 * application/x-www-form-urlencoded format. When overriding this method, consider overriding
 * {@link #getBodyContentType()} as well to match the new body format.
 *
 * @throws AuthFailureError in the event of auth failure
 */
public byte[] getBody() throws AuthFailureError {
  Map<String, String> params = getParams();
  if (params != null && params.size() > 0) {
    return encodeParameters(params, getParamsEncoding());
  }
  return null;
}

代码示例来源:origin: jungletian/TitanjumNote

/**
 * Returns the raw POST or PUT body to be sent.
 *
 * <p>By default, the body consists of the request parameters in
 * application/x-www-form-urlencoded format. When overriding this method, consider overriding
 * {@link #getBodyContentType()} as well to match the new body format.
 *
 * @throws AuthFailureError in the event of auth failure
 */
public byte[] getBody() throws AuthFailureError {
  Map<String, String> params = getParams();
  if (params != null && params.size() > 0) {
    return encodeParameters(params, getParamsEncoding());
  }
  return null;
}

代码示例来源:origin: AnandChowdhary/saga-android

/**
 * Returns the raw POST or PUT body to be sent.
 *
 * <p>By default, the body consists of the request parameters in
 * application/x-www-form-urlencoded format. When overriding this method, consider overriding
 * {@link #getBodyContentType()} as well to match the new body format.
 *
 * @throws AuthFailureError in the event of auth failure
 */
public byte[] getBody() throws AuthFailureError {
  Map<String, String> params = getParams();
  if (params != null && params.size() > 0) {
    return encodeParameters(params, getParamsEncoding());
  }
  return null;
}

代码示例来源:origin: chuyangliu/tastysnake

/**
 * Returns the raw POST or PUT body to be sent.
 *
 * <p>By default, the body consists of the request parameters in
 * application/x-www-form-urlencoded format. When overriding this method, consider overriding
 * {@link #getBodyContentType()} as well to match the new body format.
 *
 * @throws AuthFailureError in the event of auth failure
 */
public byte[] getBody() throws AuthFailureError {
  Map<String, String> params = getParams();
  if (params != null && params.size() > 0) {
    return encodeParameters(params, getParamsEncoding());
  }
  return null;
}

代码示例来源:origin: CaMnter/AndroidLife

/**
 * Returns the raw POST or PUT body to be sent.
 *
 * <p>By default, the body consists of the request parameters in
 * application/x-www-form-urlencoded format. When overriding this method, consider overriding
 * {@link #getBodyContentType()} as well to match the new body format.
 *
 * @throws AuthFailureError in the event of auth failure
 */
/*
 * 该方法的出现是为了 新版本中废弃的 getPostBody() 方法
 *
 * 获取 POST 或 PUT 请求的 body 数据
 */
public byte[] getBody() throws AuthFailureError {
  Map<String, String> params = getParams();
  if (params != null && params.size() > 0) {
    return encodeParameters(params, getParamsEncoding());
  }
  return null;
}

相关文章

微信公众号

最新文章

更多