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

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

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

/**
 * 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;
}

相关文章