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

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

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

Request.getPostParams介绍

[英]Returns a Map of POST parameters to be used for this request, or null if a simple GET should be used. Can throw AuthFailureError as authentication may be required to provide these values.

Note that only one of getPostParams() and getPostBody() can return a non-null value.
[中]返回用于此请求的POST参数的映射,如果应该使用简单GET,则返回null。可能会抛出AuthFailureError,因为提供这些值可能需要身份验证。
请注意,getPostParams()和getPostBody()中只有一个可以返回非空值。

代码示例

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

相关文章