Search in sources :

Example 1 with CustomDbxRawClientV2

use of com.dropbox.core.v2.CustomDbxRawClientV2 in project cyberduck by iterate-ch.

the class DropboxSession method connect.

@Override
protected CustomDbxRawClientV2 connect(final Proxy proxy, final HostKeyCallback callback, final LoginCallback prompt, final CancelCallback cancel) {
    final HttpClientBuilder configuration = builder.build(proxy, this, prompt);
    authorizationService = new OAuth2RequestInterceptor(configuration.build(), host.getProtocol()).withRedirectUri(host.getProtocol().getOAuthRedirectUrl());
    configuration.addInterceptorLast(authorizationService);
    configuration.setServiceUnavailableRetryStrategy(new OAuth2ErrorResponseInterceptor(host, authorizationService, prompt));
    final CloseableHttpClient client = configuration.build();
    return new CustomDbxRawClientV2(DbxRequestConfig.newBuilder(useragent.get()).withAutoRetryDisabled().withHttpRequestor(new DropboxCommonsHttpRequestExecutor(client)).build(), DbxHost.DEFAULT, null, null);
}
Also used : CloseableHttpClient(org.apache.http.impl.client.CloseableHttpClient) CustomDbxRawClientV2(com.dropbox.core.v2.CustomDbxRawClientV2) OAuth2RequestInterceptor(ch.cyberduck.core.oauth.OAuth2RequestInterceptor) OAuth2ErrorResponseInterceptor(ch.cyberduck.core.oauth.OAuth2ErrorResponseInterceptor) HttpClientBuilder(org.apache.http.impl.client.HttpClientBuilder)

Aggregations

OAuth2ErrorResponseInterceptor (ch.cyberduck.core.oauth.OAuth2ErrorResponseInterceptor)1 OAuth2RequestInterceptor (ch.cyberduck.core.oauth.OAuth2RequestInterceptor)1 CustomDbxRawClientV2 (com.dropbox.core.v2.CustomDbxRawClientV2)1 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)1 HttpClientBuilder (org.apache.http.impl.client.HttpClientBuilder)1