|
1 | 1 | package com.github.scribejava.core.oauth; |
2 | 2 |
|
3 | | -import com.github.scribejava.core.exceptions.OAuthException; |
4 | 3 | import com.github.scribejava.core.httpclient.HttpClientProvider; |
5 | 4 | import com.github.scribejava.core.model.AbstractRequest; |
6 | | -import com.github.scribejava.core.model.ForceTypeOfHttpRequest; |
7 | 5 | import com.github.scribejava.core.httpclient.HttpClient; |
8 | 6 | import com.github.scribejava.core.httpclient.HttpClientConfig; |
9 | 7 | import com.github.scribejava.core.model.OAuthAsyncRequestCallback; |
10 | 8 | import com.github.scribejava.core.model.OAuthConfig; |
11 | 9 | import com.github.scribejava.core.model.OAuthRequest; |
12 | 10 | import com.github.scribejava.core.model.OAuthRequestAsync; |
13 | 11 | import com.github.scribejava.core.model.Response; |
14 | | -import com.github.scribejava.core.model.ScribeJavaConfig; |
15 | 12 | import com.github.scribejava.core.model.Token; |
16 | 13 | import java.io.File; |
17 | 14 |
|
@@ -32,26 +29,12 @@ public abstract class OAuthService<T extends Token> { |
32 | 29 |
|
33 | 30 | public OAuthService(OAuthConfig config) { |
34 | 31 | this.config = config; |
35 | | - final ForceTypeOfHttpRequest forceTypeOfHttpRequest = ScribeJavaConfig.getForceTypeOfHttpRequests(); |
36 | 32 | final HttpClientConfig httpClientConfig = config.getHttpClientConfig(); |
37 | 33 | final HttpClient externalHttpClient = config.getHttpClient(); |
38 | 34 |
|
39 | 35 | if (httpClientConfig == null && externalHttpClient == null) { |
40 | | - if (ForceTypeOfHttpRequest.FORCE_ASYNC_ONLY_HTTP_REQUESTS == forceTypeOfHttpRequest) { |
41 | | - throw new OAuthException("Cannot use sync operations, only async"); |
42 | | - } |
43 | | - if (ForceTypeOfHttpRequest.PREFER_ASYNC_ONLY_HTTP_REQUESTS == forceTypeOfHttpRequest) { |
44 | | - config.log("Cannot use sync operations, only async"); |
45 | | - } |
46 | 36 | httpClient = null; |
47 | 37 | } else { |
48 | | - if (ForceTypeOfHttpRequest.FORCE_SYNC_ONLY_HTTP_REQUESTS == forceTypeOfHttpRequest) { |
49 | | - throw new OAuthException("Cannot use async operations, only sync"); |
50 | | - } |
51 | | - if (ForceTypeOfHttpRequest.PREFER_SYNC_ONLY_HTTP_REQUESTS == forceTypeOfHttpRequest) { |
52 | | - config.log("Cannot use async operations, only sync"); |
53 | | - } |
54 | | - |
55 | 38 | httpClient = externalHttpClient == null ? getClient(httpClientConfig) : externalHttpClient; |
56 | 39 | } |
57 | 40 | } |
@@ -86,14 +69,6 @@ public OAuthConfig getConfig() { |
86 | 69 | public <T> Future<T> execute(OAuthRequestAsync request, OAuthAsyncRequestCallback<T> callback, |
87 | 70 | OAuthRequestAsync.ResponseConverter<T> converter) { |
88 | 71 |
|
89 | | - final ForceTypeOfHttpRequest forceTypeOfHttpRequest = ScribeJavaConfig.getForceTypeOfHttpRequests(); |
90 | | - if (ForceTypeOfHttpRequest.FORCE_SYNC_ONLY_HTTP_REQUESTS == forceTypeOfHttpRequest) { |
91 | | - throw new OAuthException("Cannot use async operations, only sync"); |
92 | | - } |
93 | | - if (ForceTypeOfHttpRequest.PREFER_SYNC_ONLY_HTTP_REQUESTS == forceTypeOfHttpRequest) { |
94 | | - config.log("Cannot use async operations, only sync"); |
95 | | - } |
96 | | - |
97 | 72 | final File filePayload = request.getFilePayload(); |
98 | 73 | if (filePayload != null) { |
99 | 74 | return httpClient.executeAsync(config.getUserAgent(), request.getHeaders(), request.getVerb(), |
|