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

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

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

Request.getParamsEncoding介绍

[英]Returns which encoding should be used when converting POST or PUT parameters returned by #getRequestParams() into a raw POST or PUT body.

This controls both encodings:

  1. The string encoding used when converting parameter names and values into bytes prior to URL encoding them.
  2. The string encoding used when converting the URL encoded parameters into a raw byte array.
    [中]返回将#getRequestParams()返回的POST或PUT参数转换为原始POST或PUT正文时应使用的编码。
    这将控制两种编码:
    1.在URL编码之前,将参数名称和值转换为字节时使用的字符串编码。
    1.将URL编码参数转换为原始字节数组时使用的字符串编码。

代码示例

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

/**
 * Returns the content type of the POST or PUT body.
 */
public String getBodyContentType() {
  return "application/x-www-form-urlencoded; charset=" + getParamsEncoding();
}

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

/**
 * Returns the content type of the POST or PUT body.
 */
public String getBodyContentType() {
  return "application/x-www-form-urlencoded; charset=" + getParamsEncoding();
}

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

/**
 * Returns the content type of the POST or PUT body.
 */
public String getBodyContentType() {
  return "application/x-www-form-urlencoded; charset=" + getParamsEncoding();
}

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

/**
 * Returns which encoding should be used when converting POST parameters returned by
 * {@link #getPostParams()} into a raw POST body.
 *
 * <p>This controls both encodings:
 * <ol>
 *     <li>The string encoding used when converting parameter names and values into bytes prior
 *         to URL encoding them.</li>
 *     <li>The string encoding used when converting the URL encoded parameters into a raw
 *         byte array.</li>
 * </ol>
 *
 * @deprecated Use {@link #getParamsEncoding()} instead.
 */
@Deprecated
protected String getPostParamsEncoding() {
  return getParamsEncoding();
}

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

/**
 * Returns which encoding should be used when converting POST parameters returned by
 * {@link #getPostParams()} into a raw POST body.
 *
 * <p>This controls both encodings:
 * <ol>
 *     <li>The string encoding used when converting parameter names and values into bytes prior
 *         to URL encoding them.</li>
 *     <li>The string encoding used when converting the URL encoded parameters into a raw
 *         byte array.</li>
 * </ol>
 *
 * @deprecated Use {@link #getParamsEncoding()} instead.
 */
@Deprecated
protected String getPostParamsEncoding() {
  return getParamsEncoding();
}

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

/**
 * Returns which encoding should be used when converting POST parameters returned by
 * {@link #getPostParams()} into a raw POST body.
 *
 * <p>This controls both encodings:
 * <ol>
 *     <li>The string encoding used when converting parameter names and values into bytes prior
 *         to URL encoding them.</li>
 *     <li>The string encoding used when converting the URL encoded parameters into a raw
 *         byte array.</li>
 * </ol>
 *
 * @deprecated Use {@link #getParamsEncoding()} instead.
 */
@Deprecated
protected String getPostParamsEncoding() {
  return getParamsEncoding();
}

代码示例来源: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: 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: tazimete/android-app-food-delivery-system

/**
 * Returns the content type of the POST or PUT body.
 */
public String getBodyContentType() {
  return "application/x-www-form-urlencoded; charset=" + getParamsEncoding();
}

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

/**
 * Returns the content type of the POST or PUT body.
 */
public String getBodyContentType() {
  return "application/x-www-form-urlencoded; charset=" + getParamsEncoding();
}

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

/**
 * Returns the content type of the POST or PUT body.
 */
public String getBodyContentType() {
  return "application/x-www-form-urlencoded; charset=" + getParamsEncoding();
}

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

/**
 * Returns the content type of the POST or PUT body.
 */
public String getBodyContentType() {
  return "application/x-www-form-urlencoded; charset=" + getParamsEncoding();
}

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

/**
 * Returns the content type of the POST or PUT body.
 */
public String getBodyContentType() {
  return "application/x-www-form-urlencoded; charset=" + getParamsEncoding();
}

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

/**
 * Returns the content type of the POST or PUT body.
 */
public String getBodyContentType() {
  return "application/x-www-form-urlencoded; charset=" + getParamsEncoding();
}

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

/**
 * Returns the content type of the POST or PUT body.
 */
public String getBodyContentType() {
  return "application/x-www-form-urlencoded; charset=" + getParamsEncoding();
}

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

/**
 * Returns the content type of the POST or PUT body.
 */
/*
 * 该方法的出现是为了 新版本中废弃的 getPostBodyContentType() 方法
 *
 * 获取该 请求的 POST 或 PUT 请求 body 的 Content-Type
 */
public String getBodyContentType() {
  return "application/x-www-form-urlencoded; charset=" + getParamsEncoding();
}

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

/**
 * Returns the content type of the POST or PUT body.
 */
public String getBodyContentType() {
  return "application/x-www-form-urlencoded; charset=" + getParamsEncoding();
}

代码示例来源:origin: cat9/EasyVolley

/**
 * Returns the content type of the POST or PUT body.
 */
public String getBodyContentType() {
  createHttpEntityIfNeed();
  if(mBody!=null){
    return mBody.getContentType().getValue();
  }
  return "application/x-www-form-urlencoded; charset=" + getParamsEncoding();
}

代码示例来源: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;
}

相关文章

微信公众号

最新文章

更多