com.amazonaws.http.AmazonHttpClient.resetRequestAfterError()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(219)

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

AmazonHttpClient.resetRequestAfterError介绍

[英]Resets the specified request, so that it can be sent again, after receiving the specified error. If a problem is encountered with resetting the request, then an AmazonClientException is thrown with the original error as the cause (not an error about being unable to reset the stream).
[中]重置指定的请求,以便在收到指定错误后可以再次发送该请求。如果重置请求时遇到问题,则会抛出AmazonClientException,并将原始错误作为原因(而不是无法重置流的错误)。

代码示例

代码示例来源:origin: aws-amplify/aws-sdk-android

@Test
public void testResetRequestAfterErrorWithNullContent() {
  final Request<?> testRequest = new DefaultRequest<String>("test");
  testRequest.setContent(null);
  Exception cause = new Exception();
  // Should be no-op
  client.resetRequestAfterError(testRequest, cause);
}

代码示例来源:origin: aws-amplify/aws-sdk-android

@Test(expected = AmazonClientException.class)
public void testResetRequestAfterErrorWithNonRepeatableContent() {
  final Request<?> testRequest = new DefaultRequest<String>("test");
  testRequest.setContent(new InputStream() {
    @Override
    public boolean markSupported() {
      return false;
    }
    @Override
    public int read() throws IOException {
      return 0;
    }
  });
  Exception cause = new Exception();
  // Should be no-op
  client.resetRequestAfterError(testRequest, cause);
}

代码示例来源:origin: aws-amplify/aws-sdk-android

@Test(expected = AmazonClientException.class)
public void testResetRequestAfterErrorWithNonResetableContent() {
  final Request<?> testRequest = new DefaultRequest<String>("test");
  testRequest.setContent(new InputStream() {
    @Override
    public void reset() {
      throw new RuntimeException("CannotReset");
    }
    @Override
    public int read() throws IOException {
      return 0;
    }
  });
  Exception cause = new Exception();
  // Should be no-op
  client.resetRequestAfterError(testRequest, cause);
}

代码示例来源:origin: aws-amplify/aws-sdk-android

SDKGlobalConfiguration.setGlobalTimeOffset(timeOffset);
    resetRequestAfterError(request, ase);
  resetRequestAfterError(request, ioe);
} catch (final RuntimeException e) {
  throw handleUnexpectedFailure(e, awsRequestMetrics);

代码示例来源:origin: com.gluonhq/aws-java-sdk-core

SDKGlobalConfiguration.setGlobalTimeOffset(timeOffset);
    resetRequestAfterError(request, ase);
  resetRequestAfterError(request, ioe);
} catch (final RuntimeException e) {
  throw handleUnexpectedFailure(e, awsRequestMetrics);

代码示例来源:origin: com.amazonaws/aws-android-sdk-core

SDKGlobalConfiguration.setGlobalTimeOffset(timeOffset);
    resetRequestAfterError(request, ase);
  resetRequestAfterError(request, ioe);
} catch (final RuntimeException e) {
  throw handleUnexpectedFailure(e, awsRequestMetrics);

相关文章