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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. /**
  2. * Returns the raw POST body to be sent.
  3. *
  4. * @throws AuthFailureError In the event of auth failure
  5. * @deprecated Use {@link #getBody()} instead.
  6. */
  7. /*
  8. * 已经废弃了!
  9. *
  10. * 获取 POST 请求的 body
  11. */
  12. @Deprecated public byte[] getPostBody() throws AuthFailureError {
  13. // Note: For compatibility with legacy clients of volley, this implementation must remain
  14. // here instead of simply calling the getBody() function because this function must
  15. // call getPostParams() and getPostParamsEncoding() since legacy clients would have
  16. // overridden these two member functions for POST requests.
  17. /*
  18. * 这里是为了兼容老版本
  19. * 老版本里的 getPostBody() 方法调用了: getPostParams() 和 getPostParamsEncoding()
  20. * 而新的版本里推荐的 getBody() 方法调用了:getParams() 和 getParamsEncoding()
  21. */
  22. Map<String, String> postParams = getPostParams();
  23. if (postParams != null && postParams.size() > 0) {
  24. return encodeParameters(postParams, getPostParamsEncoding());
  25. }
  26. return null;
  27. }

相关文章