@Override public HttpRequestIntent httpRequestIntent() { return sphereRequest.httpRequestIntent(); }
@Override public HttpRequestIntent httpRequestIntent() { return delegate.httpRequestIntent(); }
@Override public HttpRequestIntent httpRequestIntent() { return sphereRequest.httpRequestIntent(); }
@Override public HttpRequestIntent httpRequestIntent() { return sphereRequest.httpRequestIntent(); }
@Override public HttpRequestIntent httpRequestIntent() { return sphereRequest.httpRequestIntent(); }
@Override public <T> CompletionStage<T> execute(final SphereRequest<T> sphereRequest) { final T result = (T) function.apply(sphereRequest.httpRequestIntent()); return successful(result); }
@Override public <T> CompletionStage<T> execute(final SphereRequest<T> sphereRequest) { final T result = (T) function.apply(sphereRequest.httpRequestIntent()); return successful(result); }
@Override public <T> CompletionStage<T> execute(final SphereRequest<T> sphereRequest) { final T result = (T) function.apply(sphereRequest.httpRequestIntent()); return successful(result); }
@Override public <T> CompletableFuture<T> execute(final SphereRequest<T> sphereRequest) { final T result = (T) function.apply(sphereRequest.httpRequestIntent()); return successful(result); }
@Override public <T> CompletionStage<T> execute(final SphereRequest<T> sphereRequest) { final T result = (T) function.apply(sphereRequest.httpRequestIntent()); return successful(result); }
public void setSphereRequest(@Nullable final SphereRequest<?> sphereRequest) { this.sphereRequest = sphereRequest; setHttpRequestIntent(sphereRequest.httpRequestIntent()); }
@Override public <T> CompletionStage<T> execute(final SphereRequest<T> sphereRequest) { final HttpRequestIntent httpRequest = sphereRequest.httpRequestIntent(); final HttpResponse httpResponse = function.apply(httpRequest); try { final T t = SphereClientImpl.parse(sphereRequest, objectMapper, sphereApiConfig, httpResponse, null); return CompletableFutureUtils.successful(t); } catch (final Exception e) { return CompletableFutureUtils.failed(e); } }
@Override public <T> CompletionStage<T> execute(final SphereRequest<T> sphereRequest) { final HttpRequestIntent httpRequest = sphereRequest.httpRequestIntent(); final HttpResponse httpResponse = function.apply(httpRequest); try { final T t = SphereClientImpl.parse(sphereRequest, objectMapper, sphereApiConfig, httpResponse, null); return CompletableFutureUtils.successful(t); } catch (final Exception e) { return CompletableFutureUtils.failed(e); } }
@Override public <T> CompletionStage<T> execute(final SphereRequest<T> sphereRequest) { final HttpRequestIntent httpRequest = sphereRequest.httpRequestIntent(); final HttpResponse httpResponse = function.apply(httpRequest); try { final T t = SphereClientImpl.parse(sphereRequest, objectMapper, SphereApiConfig.of("fake-project-key-for-testing", "https://createHttpTestDouble.tld"), httpResponse); return CompletableFutureUtils.successful(t); } catch (final Exception e) { return CompletableFutureUtils.failed(e); } }
@Override public <T> CompletableFuture<T> execute(final SphereRequest<T> sphereRequest) { final HttpRequestIntent httpRequest = sphereRequest.httpRequestIntent(); final HttpResponse httpResponse = function.apply(httpRequest); try { final T t = SphereClientImpl.parse(httpResponse, sphereRequest, objectMapper, SphereApiConfig.of("createHttpTestDouble", "https://createHttpTestDouble.tld")); return CompletableFutureUtils.successful(t); } catch (final Exception e) { return CompletableFutureUtils.failed(e); } }
private <T> HttpRequest createHttpRequest(final SphereRequest<T> sphereRequest, final String token) { return sphereRequest .httpRequestIntent() .plusHeader("User-Agent", "SPHERE.IO JVM SDK " + BuildInfo.version()) .plusHeader(HttpHeaders.AUTHORIZATION, "Bearer " + token) .prefixPath("/" + config.getProjectKey()) .toHttpRequest(config.getApiUrl()); }
private <T> HttpRequest createHttpRequest(final SphereRequest<T> sphereRequest, final String token) { return sphereRequest .httpRequestIntent() .plusHeader(HttpHeaders.USER_AGENT, BuildInfo.userAgent()) .plusHeader(HttpHeaders.ACCEPT_ENCODING, "gzip") .plusHeader(HttpHeaders.AUTHORIZATION, "Bearer " + token) .prefixPath("/" + config.getProjectKey()) .toHttpRequest(config.getApiUrl()); }
private <T> HttpRequest createHttpRequest(final SphereRequest<T> sphereRequest, final String token) { final String correlationId = correlationIdGenerator.get(); return sphereRequest .httpRequestIntent() .plusHeader(HttpHeaders.X_CORRELATION_ID, correlationId) .plusHeader(HttpHeaders.USER_AGENT, userAgent) .plusHeader(HttpHeaders.ACCEPT_ENCODING, "gzip") .plusHeader(HttpHeaders.AUTHORIZATION, "Bearer " + token) .prefixPath("/" + config.getProjectKey()) .toHttpRequest(config.getApiUrl()); }
private <T> HttpRequest createHttpRequest(final SphereRequest<T> sphereRequest, final String token) { final String correlationId = correlationIdGenerator.get(); return sphereRequest .httpRequestIntent() .plusHeader(HttpHeaders.X_CORRELATION_ID, correlationId) .plusHeader(HttpHeaders.USER_AGENT, userAgent) .plusHeader(HttpHeaders.ACCEPT_ENCODING, "gzip") .plusHeader(HttpHeaders.AUTHORIZATION, "Bearer " + token) .prefixPath("/" + config.getProjectKey()) .toHttpRequest(config.getApiUrl()); }
private static Predicate<RetryContext> isDeleteAndNewVersionIsKnown() { return retryContext -> retryContext.getLatestError() instanceof ConcurrentModificationException && ((ConcurrentModificationException) retryContext.getLatestError()).getCurrentVersion() != null && retryContext.getLatestParameter() instanceof SphereRequest && ((SphereRequest) retryContext.getLatestParameter()).httpRequestIntent().getHttpMethod() == HttpMethod.DELETE; }