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

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

本文整理了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

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

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

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

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

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

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

  1. /**
  2. * Returns which encoding should be used when converting POST parameters returned by
  3. * {@link #getPostParams()} into a raw POST body.
  4. *
  5. * <p>This controls both encodings:
  6. * <ol>
  7. * <li>The string encoding used when converting parameter names and values into bytes prior
  8. * to URL encoding them.</li>
  9. * <li>The string encoding used when converting the URL encoded parameters into a raw
  10. * byte array.</li>
  11. * </ol>
  12. *
  13. * @deprecated Use {@link #getParamsEncoding()} instead.
  14. */
  15. @Deprecated
  16. protected String getPostParamsEncoding() {
  17. return getParamsEncoding();
  18. }

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

  1. /**
  2. * Returns which encoding should be used when converting POST parameters returned by
  3. * {@link #getPostParams()} into a raw POST body.
  4. *
  5. * <p>This controls both encodings:
  6. * <ol>
  7. * <li>The string encoding used when converting parameter names and values into bytes prior
  8. * to URL encoding them.</li>
  9. * <li>The string encoding used when converting the URL encoded parameters into a raw
  10. * byte array.</li>
  11. * </ol>
  12. *
  13. * @deprecated Use {@link #getParamsEncoding()} instead.
  14. */
  15. @Deprecated
  16. protected String getPostParamsEncoding() {
  17. return getParamsEncoding();
  18. }

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

  1. /**
  2. * Returns which encoding should be used when converting POST parameters returned by
  3. * {@link #getPostParams()} into a raw POST body.
  4. *
  5. * <p>This controls both encodings:
  6. * <ol>
  7. * <li>The string encoding used when converting parameter names and values into bytes prior
  8. * to URL encoding them.</li>
  9. * <li>The string encoding used when converting the URL encoded parameters into a raw
  10. * byte array.</li>
  11. * </ol>
  12. *
  13. * @deprecated Use {@link #getParamsEncoding()} instead.
  14. */
  15. @Deprecated
  16. protected String getPostParamsEncoding() {
  17. return getParamsEncoding();
  18. }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. /**
  2. * Returns the content type of the POST or PUT body.
  3. */
  4. public String getBodyContentType() {
  5. createHttpEntityIfNeed();
  6. if(mBody!=null){
  7. return mBody.getContentType().getValue();
  8. }
  9. return "application/x-www-form-urlencoded; charset=" + getParamsEncoding();
  10. }

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

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

相关文章