当前位置: 首页>>代码示例>>Java>>正文


Java HttpIOExceptionHandler类代码示例

本文整理汇总了Java中com.google.api.client.http.HttpIOExceptionHandler的典型用法代码示例。如果您正苦于以下问题:Java HttpIOExceptionHandler类的具体用法?Java HttpIOExceptionHandler怎么用?Java HttpIOExceptionHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HttpIOExceptionHandler类属于com.google.api.client.http包,在下文中一共展示了HttpIOExceptionHandler类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import com.google.api.client.http.HttpIOExceptionHandler; //导入依赖的package包/类
@Override
public void initialize(HttpRequest request) throws IOException {
  List<HttpIOExceptionHandler> ioExceptionHandlers = new ArrayList<>();
  List<HttpUnsuccessfulResponseHandler> unsuccessfulResponseHandlers = new ArrayList<>();
  List<HttpExecuteInterceptor> interceptors = new ArrayList<>();
  List<HttpResponseInterceptor> responseInterceptors = new ArrayList<>();
  for (HttpRequestInitializer initializer : initializers) {
    initializer.initialize(request);
    if (request.getIOExceptionHandler() != null) {
      ioExceptionHandlers.add(request.getIOExceptionHandler());
      request.setIOExceptionHandler(null);
    }
    if (request.getUnsuccessfulResponseHandler() != null) {
      unsuccessfulResponseHandlers.add(request.getUnsuccessfulResponseHandler());
      request.setUnsuccessfulResponseHandler(null);
    }
    if (request.getInterceptor() != null) {
      interceptors.add(request.getInterceptor());
      request.setInterceptor(null);
    }
    if (request.getResponseInterceptor() != null) {
      responseInterceptors.add(request.getResponseInterceptor());
      request.setResponseInterceptor(null);
    }
  }
  request.setIOExceptionHandler(
      makeIoExceptionHandler(ioExceptionHandlers));
  request.setUnsuccessfulResponseHandler(
      makeUnsuccessfulResponseHandler(unsuccessfulResponseHandlers));
  request.setInterceptor(
      makeInterceptor(interceptors));
  request.setResponseInterceptor(
      makeResponseInterceptor(responseInterceptors));
}
 
开发者ID:GoogleCloudPlatform,项目名称:bigdata-interop,代码行数:35,代码来源:ChainingHttpRequestInitializer.java

示例2: makeIoExceptionHandler

import com.google.api.client.http.HttpIOExceptionHandler; //导入依赖的package包/类
private HttpIOExceptionHandler makeIoExceptionHandler(
    final Iterable<HttpIOExceptionHandler> ioExceptionHandlers) {
  return new HttpIOExceptionHandler() {
    @Override
    public boolean handleIOException(HttpRequest request, boolean supportsRetry)
        throws IOException {
      for (HttpIOExceptionHandler handler : ioExceptionHandlers) {
        if (handler.handleIOException(request, supportsRetry)) {
          return true;
        }
      }
      return false;
    }
  };
}
 
开发者ID:GoogleCloudPlatform,项目名称:bigdata-interop,代码行数:16,代码来源:ChainingHttpRequestInitializer.java

示例3: LoggingResponseHandler

import com.google.api.client.http.HttpIOExceptionHandler; //导入依赖的package包/类
/**
 * @param delegateResponseHandler The HttpUnsuccessfulResponseHandler to invoke to
 *    really handle errors.
 * @param delegateIOExceptionHandler The HttpIOExceptionResponseHandler to delegate to.
 * @param responseCodesToLog The set of response codes to log URLs for.
 */
public LoggingResponseHandler(
    HttpUnsuccessfulResponseHandler delegateResponseHandler,
    HttpIOExceptionHandler delegateIOExceptionHandler,
    Set<Integer> responseCodesToLog) {
  this.delegateResponseHandler = delegateResponseHandler;
  this.delegateIOExceptionHandler = delegateIOExceptionHandler;
  this.responseCodesToLog = ImmutableSet.copyOf(responseCodesToLog);
}
 
开发者ID:GoogleCloudPlatform,项目名称:bigdata-interop,代码行数:15,代码来源:RetryHttpInitializer.java


注:本文中的com.google.api.client.http.HttpIOExceptionHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。