11package com .github .scribejava .core .builder ;
22
33import com .github .scribejava .core .builder .api .BaseApi ;
4+ import com .github .scribejava .core .model .HttpClient ;
45import com .github .scribejava .core .model .OAuthConfig ;
5- import java .io .OutputStream ;
66import com .github .scribejava .core .model .OAuthConstants ;
77import com .github .scribejava .core .model .SignatureType ;
88import com .github .scribejava .core .oauth .OAuthService ;
99import com .github .scribejava .core .utils .Preconditions ;
1010
11+ import java .io .OutputStream ;
12+
1113/**
1214 * Implementation of the Builder pattern, with a fluent interface that creates a {@link OAuthService}
1315 */
@@ -27,12 +29,8 @@ public class ServiceBuilder {
2729 private Integer connectTimeout ;
2830 private Integer readTimeout ;
2931
30- //async version only
31- //ning 1.9
32- private com .ning .http .client .AsyncHttpClientConfig ningAsyncHttpClientConfig ;
33- private String ningAsyncHttpProviderClassName ;
34- //AHC 2.0
35- private org .asynchttpclient .AsyncHttpClientConfig ahcAsyncHttpClientConfig ;
32+ //not-default httpclient only
33+ private HttpClient .Config httpClientConfig ;
3634
3735 public ServiceBuilder () {
3836 callback = OAuthConstants .OUT_OF_BAND ;
@@ -135,24 +133,9 @@ public ServiceBuilder readTimeout(Integer readTimeout) {
135133 return this ;
136134 }
137135
138- public ServiceBuilder asyncNingHttpClientConfig (com .ning .http .client .AsyncHttpClientConfig asyncHttpClientConfig ) {
139- Preconditions .checkNotNull (asyncHttpClientConfig , "asyncHttpClientConfig can't be null" );
140- ningAsyncHttpClientConfig = asyncHttpClientConfig ;
141- ahcAsyncHttpClientConfig = null ;
142- return this ;
143- }
144-
145- public ServiceBuilder asyncNingHttpProviderClassName (String asyncHttpProviderClassName ) {
146- this .ningAsyncHttpProviderClassName = asyncHttpProviderClassName ;
147- ahcAsyncHttpClientConfig = null ;
148- return this ;
149- }
150-
151- public ServiceBuilder asyncAHCHttpClientConfig (org .asynchttpclient .AsyncHttpClientConfig asyncHttpClientConfig ) {
152- Preconditions .checkNotNull (asyncHttpClientConfig , "asyncHttpClientConfig can't be null" );
153- ahcAsyncHttpClientConfig = asyncHttpClientConfig ;
154- ningAsyncHttpClientConfig = null ;
155- ningAsyncHttpProviderClassName = null ;
136+ public ServiceBuilder httpClientConfig (HttpClient .Config httpClientConfig ) {
137+ Preconditions .checkNotNull (httpClientConfig , "httpClientConfig can't be null" );
138+ this .httpClientConfig = httpClientConfig ;
156139 return this ;
157140 }
158141
@@ -173,8 +156,7 @@ public void checkPreconditions() {
173156 private OAuthConfig createConfig () {
174157 checkPreconditions ();
175158 return new OAuthConfig (apiKey , apiSecret , callback , signatureType , scope , debugStream , state , responseType ,
176- userAgent , connectTimeout , readTimeout , ningAsyncHttpClientConfig , ningAsyncHttpProviderClassName ,
177- ahcAsyncHttpClientConfig );
159+ userAgent , connectTimeout , readTimeout , httpClientConfig );
178160 }
179161
180162 /**
0 commit comments