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

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

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

Request.encodeParameters介绍

[英]Converts params into an application/x-www-form-urlencoded encoded string.
[中]将params转换为应用程序/x-www-form-urlencoded字符串。

代码示例

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

代码示例来源: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: MewX/light-novel-library_Wenku8_Android

  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: 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: com.mcxiaoke.volley/library

  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: 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: 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: panxw/android-volley-manager

  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: tazimete/android-app-food-delivery-system

  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: tazimete/android-app-food-delivery-system

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

  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: AnandChowdhary/saga-android

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

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

  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. /*
  11. * 该方法的出现是为了 新版本中废弃的 getPostBody() 方法
  12. *
  13. * 获取 POST 或 PUT 请求的 body 数据
  14. */
  15. public byte[] getBody() throws AuthFailureError {
  16. Map<String, String> params = getParams();
  17. if (params != null && params.size() > 0) {
  18. return encodeParameters(params, getParamsEncoding());
  19. }
  20. return null;
  21. }

相关文章