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

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

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

Request.getPostParamsEncoding介绍

[英]Returns which encoding should be used when converting POST parameters returned by #getPostParams() into a raw POST 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.
    [中]返回将#getPostParams()返回的POST参数转换为原始POST正文时应使用的编码。
    这将控制两种编码:
    1.在URL编码之前,将参数名称和值转换为字节时使用的字符串编码。
    1.将URL编码参数转换为原始字节数组时使用的字符串编码。

代码示例

代码示例来源: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 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: 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: 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: 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: AnandChowdhary/saga-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: 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: panxw/android-volley-manager

/**
 * 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: jungletian/TitanjumNote

/**
 * 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: chuyangliu/tastysnake

/**
 * 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: 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: CaMnter/AndroidLife

/**
 * Returns the raw POST body to be sent.
 *
 * @throws AuthFailureError In the event of auth failure
 * @deprecated Use {@link #getBody()} instead.
 */
/*
 * 已经废弃了!
 *
 * 获取 POST 请求的 body
 */
@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.
  /*
   * 这里是为了兼容老版本
   * 老版本里的 getPostBody() 方法调用了: getPostParams() 和 getPostParamsEncoding()
   * 而新的版本里推荐的 getBody() 方法调用了:getParams() 和 getParamsEncoding()
   */
  Map<String, String> postParams = getPostParams();
  if (postParams != null && postParams.size() > 0) {
    return encodeParameters(postParams, getPostParamsEncoding());
  }
  return null;
}

相关文章