com.google.api.client.http.HttpResponse.getContentType()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(123)

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

HttpResponse.getContentType介绍

暂无

代码示例

代码示例来源:origin: deric/gitlab-ci-mesos

public void content(HttpResponse response) throws IOException {
  //Result result = response.parseAs(Result.class);
  System.out.println(response.getStatusCode());
  System.out.println(response.getStatusMessage());
  System.out.println(response.getContentType());
  InputStream is = response.getContent();
  int ch;
  while ((ch = is.read()) != -1) {
    System.out.print((char) ch);
  }
  response.disconnect();
}

代码示例来源:origin: com.google.http-client/google-http-client-xml

InputStream content = response.getContent();
try {
 Atom.checkContentType(response.getContentType());
 XmlPullParser parser = Xml.createParser();
 parser.setInput(content, null);

代码示例来源:origin: googleads/googleads-java-lib

String contentType = httpResponse.getContentType();

代码示例来源:origin: com.google.api-ads/ads-lib-axis

String contentType = httpResponse.getContentType();

代码示例来源:origin: com.google.cloud.datastore/datastore-v1beta3-proto-client

if (!httpResponse.isSuccessStatusCode()) {
 throw makeException(url, methodName, httpResponse.getContent(),
   httpResponse.getContentType(), httpResponse.getContentCharset(), null,
   httpResponse.getStatusCode());

代码示例来源:origin: com.jdcloud.sdk/core

protected JdcloudResponse handlerHttpResponse(HttpResponse httpResponse) throws IOException,IllegalAccessException,InstantiationException, JAXBException{
  String contentType = httpResponse.getContentType();
  if(httpResponse.getContent() != null && httpResponse.getStatusCode() != 204  && httpResponse.getStatusCode() != 304) {
    JdcloudResponse response;
    if(ContentType.TEXT_XML.toString().equals(contentType)) {
      response = (JdcloudResponse) getUnmarshaller().unmarshall(ConvertUtils.xmlToJson(httpResponse.getContent()));
    } else {
      response = (JdcloudResponse) getUnmarshaller().unmarshall(jdcloudClient.readValue(httpResponse.getContent()));
    }
    if (null == response){
      throw new JdcloudSdkException("Illegal Content");
    }
    response.setOriginalResponse(httpResponse);
    return response;
  }
  Object o = httpResponse.getHeaders().get("x-jdcloud-request-id");
  if(o instanceof ArrayList) {
    String reqId = (String)((ArrayList) o).get(0);
    JdcloudResponse ret = returnType().newInstance();
    ret.setRequestId(reqId);
    ret.setOriginalResponse(httpResponse);
    return ret;
  }
  return returnType().newInstance();
}

代码示例来源:origin: GoogleCloudPlatform/google-cloud-datastore

try (InputStream content = GzipFixingInputStream.maybeWrap(httpResponse.getContent())) {
 throw makeException(url, methodName, content,
   httpResponse.getContentType(), httpResponse.getContentCharset(), null,
   httpResponse.getStatusCode());

代码示例来源:origin: com.google.cloud.datastore/datastore-v1-proto-client

try (InputStream content = GzipFixingInputStream.maybeWrap(httpResponse.getContent())) {
 throw makeException(url, methodName, content,
   httpResponse.getContentType(), httpResponse.getContentCharset(), null,
   httpResponse.getStatusCode());

代码示例来源:origin: com.google.api-client/google-api-client

try {
 if (!response.isSuccessStatusCode()
   && HttpMediaType.equalsIgnoreParameters(Json.MEDIA_TYPE, response.getContentType())
   && response.getContent() != null) {
  JsonParser parser = null;

相关文章