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

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

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

HttpResponse.getRequest介绍

暂无

代码示例

代码示例来源:origin: GoogleContainerTools/jib

/** @return the original request URL */
 public GenericUrl getRequestUrl() {
  return httpResponse.getRequest().getUrl();
 }
}

代码示例来源:origin: com.google.cloud.tools/jib-maven-plugin

/** @return the original request URL */
 public GenericUrl getRequestUrl() {
  return httpResponse.getRequest().getUrl();
 }
}

代码示例来源:origin: gradle.plugin.com.google.cloud.tools/jib-gradle-plugin

/** @return the original request URL */
 public GenericUrl getRequestUrl() {
  return httpResponse.getRequest().getUrl();
 }
}

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

@Override
 public void interceptResponse(HttpResponse response) throws IOException {
  if (response == null) {
   return;
  }
  reportServiceLogger.logRequest(
    response.getRequest(), response.getStatusCode(), response.getStatusMessage());
 }
}

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

@Override
 public void interceptResponse(HttpResponse response) throws IOException {
  if (response == null) {
   return;
  }
  reportServiceLogger.logRequest(
    response.getRequest(), response.getStatusCode(), response.getStatusMessage());
 }
}

代码示例来源:origin: org.apache.beam/beam-sdks-java-extensions-google-cloud-platform-core

@Override
 public void interceptResponse(HttpResponse response) throws IOException {
  if (!LOG.isDebugEnabled()) {
   return;
  }
  String uploadId = response.getHeaders().getFirstHeaderStringValue(UPLOAD_HEADER);
  if (uploadId == null) {
   return;
  }

  GenericUrl url = response.getRequest().getUrl();
  // The check for no upload id limits the output to one log line per upload.
  // The check for upload type makes sure this is an upload and not a read.
  if (url.get(UPLOAD_ID_PARAM) == null && url.get(UPLOAD_TYPE_PARAM) != null) {
   LOG.debug(
     "Upload ID for url {} on worker {} is {}",
     url,
     System.getProperty("worker_id"),
     uploadId);
  }
 }
}

代码示例来源:origin: codice/ddf

@Override
public void onSuccess(HttpResponse httpResponse) {
 if (httpResponse != null
   && httpResponse.getStatusCode() == HttpStatusCodes.STATUS_CODE_OK) {
  try {
   String parsedResponse = httpResponse.parseAsString();
   buildEntityDescriptor(parsedResponse);
   service.shutdown();
  } catch (IOException e) {
   LOGGER.info(
     "Unable to parse metadata from: {}",
     httpResponse.getRequest().getUrl().toString(),
     e);
  }
 } else {
  LOGGER.warn("No/bad response; re-submitting request");
 }
}

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

/**
 * Sends the metadata request using the given request method to the server and returns the raw
 * metadata {@link HttpResponse}.
 */
private HttpResponse executeUnparsed(boolean usingHead) throws IOException {
 HttpResponse response;
 if (uploader == null) {
  // normal request (not upload)
  response = buildHttpRequest(usingHead).execute();
 } else {
  // upload request
  GenericUrl httpRequestUrl = buildHttpRequestUrl();
  HttpRequest httpRequest = getAbstractGoogleClient()
    .getRequestFactory().buildRequest(requestMethod, httpRequestUrl, httpContent);
  boolean throwExceptionOnExecuteError = httpRequest.getThrowExceptionOnExecuteError();
  response = uploader.setInitiationHeaders(requestHeaders)
    .setDisableGZipContent(disableGZipContent).upload(httpRequestUrl);
  response.getRequest().setParser(getAbstractGoogleClient().getObjectParser());
  // process any error
  if (throwExceptionOnExecuteError && !response.isSuccessStatusCode()) {
   throw newExceptionOnError(response);
  }
 }
 // process response
 lastResponseHeaders = response.getHeaders();
 lastStatusCode = response.getStatusCode();
 lastStatusMessage = response.getStatusMessage();
 return response;
}

相关文章