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

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

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

Request.getBodyContentType介绍

[英]Returns the content type of the POST or PUT body.
[中]返回POST或PUT正文的内容类型。

代码示例

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

/**
 * @deprecated Use {@link #getBodyContentType()} instead.
 */
@Deprecated
public String getPostBodyContentType() {
  return getBodyContentType();
}

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

/**
 * @deprecated Use {@link #getBodyContentType()} instead.
 */
@Deprecated
public String getPostBodyContentType() {
  return getBodyContentType();
}

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

/**
 * @deprecated Use {@link #getBodyContentType()} instead.
 */
@Deprecated
public String getPostBodyContentType() {
  return getBodyContentType();
}

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

private static void addBodyIfExists(HttpURLConnection connection, Request<?> request)
      throws IOException, AuthFailureError {
    byte[] body = request.getBody();
    if (body != null) {
      connection.setDoOutput(true);
      connection.addRequestProperty(HEADER_CONTENT_TYPE, request.getBodyContentType());
      DataOutputStream out = new DataOutputStream(connection.getOutputStream());
      out.write(body);
      out.close();
    }
  }
}

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

private static void addBodyIfExists(HttpURLConnection connection, Request<?> request)
      throws IOException, AuthFailureError {
    byte[] body = request.getBody();
    if (body != null) {
      connection.setDoOutput(true);
      connection.addRequestProperty(HEADER_CONTENT_TYPE, request.getBodyContentType());
      DataOutputStream out = new DataOutputStream(connection.getOutputStream());
      out.write(body);
      out.close();
    }
  }
}

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

private static void addBodyIfExists(HttpURLConnection connection, Request<?> request)
      throws IOException, AuthFailureError {
    byte[] body = request.getBody();
    if (body != null) {
      connection.setDoOutput(true);
      connection.addRequestProperty(HEADER_CONTENT_TYPE, request.getBodyContentType());
      DataOutputStream out = new DataOutputStream(connection.getOutputStream());
      out.write(body);
      out.close();
    }
  }
}

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

private static RequestBody createRequestBody(Request r) throws AuthFailureError {
    final byte[] body = r.getBody();
    if (body == null) return null;

    return RequestBody.create(MediaType.parse(r.getBodyContentType()), body);
  }
}

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

case Method.POST: {
  HttpPost postRequest = new HttpPost(request.getUrl());
  postRequest.addHeader(HEADER_CONTENT_TYPE, request.getBodyContentType());
  setEntityIfNonEmptyBody(postRequest, request);
  return postRequest;
  putRequest.addHeader(HEADER_CONTENT_TYPE, request.getBodyContentType());
  setEntityIfNonEmptyBody(putRequest, request);
  return putRequest;
case Method.PATCH: {
  HttpPatch patchRequest = new HttpPatch(request.getUrl());
  patchRequest.addHeader(HEADER_CONTENT_TYPE, request.getBodyContentType());
  setEntityIfNonEmptyBody(patchRequest, request);
  return patchRequest;

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

case Method.POST: {
  HttpPost postRequest = new HttpPost(request.getUrl());
  postRequest.addHeader(HEADER_CONTENT_TYPE, request.getBodyContentType());
  setEntityIfNonEmptyBody(postRequest, request);
  return postRequest;
  putRequest.addHeader(HEADER_CONTENT_TYPE, request.getBodyContentType());
  setEntityIfNonEmptyBody(putRequest, request);
  return putRequest;
case Method.PATCH: {
  HttpPatch patchRequest = new HttpPatch(request.getUrl());
  patchRequest.addHeader(HEADER_CONTENT_TYPE, request.getBodyContentType());
  setEntityIfNonEmptyBody(patchRequest, request);
  return patchRequest;

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

case Method.POST: {
  HttpPost postRequest = new HttpPost(request.getUrl());
  postRequest.addHeader(HEADER_CONTENT_TYPE, request.getBodyContentType());
  putRequest.addHeader(HEADER_CONTENT_TYPE, request.getBodyContentType());
  setEntityIfNonEmptyBody(putRequest, request);
  return putRequest;
case Method.PATCH: {
  HttpPatch patchRequest = new HttpPatch(request.getUrl());
  patchRequest.addHeader(HEADER_CONTENT_TYPE, request.getBodyContentType());
  setEntityIfNonEmptyBody(patchRequest, request);
  return patchRequest;

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

/**
 * @deprecated Use {@link #getBodyContentType()} instead.
 */
@Deprecated
public String getPostBodyContentType() {
  return getBodyContentType();
}

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

/**
 * @deprecated Use {@link #getBodyContentType()} instead.
 */
@Deprecated
public String getPostBodyContentType() {
  return getBodyContentType();
}

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

/**
 * @deprecated Use {@link #getBodyContentType()} instead.
 */
@Deprecated
public String getPostBodyContentType() {
  return getBodyContentType();
}

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

/**
 * @deprecated Use {@link #getBodyContentType()} instead.
 */
@Deprecated
public String getPostBodyContentType() {
  return getBodyContentType();
}

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

private static void addBodyIfExists(HttpURLConnection connection, Request<?> request)
      throws IOException, AuthFailureError {
    byte[] body = request.getBody();
    if (body != null) {
      connection.setDoOutput(true);
      connection.addRequestProperty(HEADER_CONTENT_TYPE, request.getBodyContentType());
      DataOutputStream out = new DataOutputStream(connection.getOutputStream());
      out.write(body);
      out.close();
    }
  }
}

代码示例来源:origin: avluis/Hentoid

private static RequestBody createRequestBody(Request r) throws AuthFailureError {
  final byte[] body = r.getBody();
  if (body == null) {
    return null;
  }
  return RequestBody.create(MediaType.parse(r.getBodyContentType()), body);
}

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

private static void addBodyIfExists(HttpURLConnection connection, Request<?> request)
    throws IOException, AuthFailureError {
  byte[] body = request.getBody();
  if (body != null) {
    connection.setDoOutput(true);
    connection.addRequestProperty(HEADER_CONTENT_TYPE, request.getBodyContentType());
    DataOutputStream out = new DataOutputStream(connection.getOutputStream());
    out.write(body);
    out.close();
  }
}

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

private static void addBodyIfExists(HttpURLConnection connection, Request<?> request)
      throws IOException, AuthFailureError {
    byte[] body = request.getBody();
    if (body != null) {
      connection.setDoOutput(true);
      connection.addRequestProperty(HEADER_CONTENT_TYPE, request.getBodyContentType());
      DataOutputStream out = new DataOutputStream(connection.getOutputStream());
      out.write(body);
      out.close();
    }
  }
}

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

private static void addBodyIfExists(HttpURLConnection connection, Request<?> request)
      throws IOException, AuthFailureError {
    byte[] body = request.getBody();
    if (body != null) {
      connection.setDoOutput(true);
      connection.addRequestProperty(HEADER_CONTENT_TYPE, request.getBodyContentType());
      DataOutputStream out = new DataOutputStream(connection.getOutputStream());
      out.write(body);
      out.close();
    }
  }
}

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

private static void addBodyIfExists(HttpURLConnection connection, Request<?> request)
      throws IOException, AuthFailureError {
    byte[] body = request.getBody();
    if (body != null) {
      connection.setDoOutput(true);
      connection.addRequestProperty(HEADER_CONTENT_TYPE, request.getBodyContentType());
      DataOutputStream out = new DataOutputStream(connection.getOutputStream());
      out.write(body);
      out.close();
    }
  }
}

相关文章