@Test public void testRetryRequest() { final S3HttpRequestRetryHandler h = new S3HttpRequestRetryHandler(new JetS3tRequestAuthorizer() { @Override public void authorizeHttpRequest(final HttpUriRequest httpUriRequest, final HttpContext httpContext, final String s) { } }, 1); final HttpClientContext context = new HttpClientContext(); context.setAttribute(HttpCoreContext.HTTP_REQUEST, new HttpHead()); assertTrue(h.retryRequest(new SSLException(new SocketException("Broken pipe")), 1, context)); }
@Override public boolean retryRequest(final IOException exception, final int executionCount, final HttpContext context) { if(super.retryRequest(exception, executionCount, context)) { final Object attribute = context.getAttribute(HttpCoreContext.HTTP_REQUEST); if(attribute instanceof HttpUriRequest) { final HttpUriRequest method = (HttpUriRequest) attribute; log.warn(String.format("Retrying request %s", method)); try { authorizer.authorizeHttpRequest(method, context, null); return true; } catch(ServiceException e) { log.warn("Unable to generate updated authorization string for retried request", e); } } } return false; }
S3HttpRequestRetryHandler extends ExtendedHttpRequestRetryHandler { @Override public boolean retryRequest(final IOException exception, final int executionCount, final HttpContext context) { if(super.retryRequest(exception, executionCount, context)) { final Object attribute = context.getAttribute(HttpCoreContext.HTTP_REQUEST); if(attribute instanceof HttpUriRequest) { final HttpUriRequest method = (HttpUriRequest) attribute; log.warn(String.format("Retrying request %s", method)); try { authorizer.authorizeHttpRequest(method, context, null); return true; } catch(ServiceException e) { log.warn("Unable to generate updated authorization string for retried request", e); } } } return false; } }
S3HttpRequestRetryHandler extends ExtendedHttpRequestRetryHandler { @Override public boolean retryRequest(final IOException exception, final int executionCount, final HttpContext context) { if(super.retryRequest(exception, executionCount, context)) { final Object attribute = context.getAttribute(HttpCoreContext.HTTP_REQUEST); if(attribute instanceof HttpUriRequest) { final HttpUriRequest method = (HttpUriRequest) attribute; log.warn(String.format("Retrying request %s", method)); try { authorizer.authorizeHttpRequest(method, context, null); return true; } catch(ServiceException e) { log.warn("Unable to generate updated authorization string for retried request", e); } } } return false; } S3HttpRequestRetryHandler(final JetS3tRequestAuthorizer authorizer, final int retryCount); }
S3HttpRequestRetryHandler extends ExtendedHttpRequestRetryHandler { @Override public boolean retryRequest(final IOException exception, final int executionCount, final HttpContext context) { if(super.retryRequest(exception, executionCount, context)) { final Object attribute = context.getAttribute(HttpCoreContext.HTTP_REQUEST); if(attribute instanceof HttpUriRequest) { final HttpUriRequest method = (HttpUriRequest) attribute; log.warn(String.format("Retrying request %s", method)); try { authorizer.authorizeHttpRequest(method, context, null); return true; } catch(ServiceException e) { log.warn("Unable to generate updated authorization string for retried request", e); } } } return false; } S3HttpRequestRetryHandler(final JetS3tRequestAuthorizer authorizer, final int retryCount); @Override boolean retryRequest(final IOException exception, final int executionCount, final HttpContext context); }
S3HttpRequestRetryHandler extends ExtendedHttpRequestRetryHandler { @Override public boolean retryRequest(final IOException exception, final int executionCount, final HttpContext context) { if(super.retryRequest(exception, executionCount, context)) { final Object attribute = context.getAttribute(HttpCoreContext.HTTP_REQUEST); if(attribute instanceof HttpUriRequest) { final HttpUriRequest method = (HttpUriRequest) attribute; log.warn(String.format("Retrying request %s", method)); try { authorizer.authorizeHttpRequest(method, context, null); return true; } catch(ServiceException e) { log.warn("Unable to generate updated authorization string for retried request", e); } } } return false; } S3HttpRequestRetryHandler(final JetS3tRequestAuthorizer authorizer, final int retryCount); @Override boolean retryRequest(final IOException exception, final int executionCount, final HttpContext context);  }