Skip to content

Commit 8c67b7a

Browse files
committed
feat: allow to modify the underlying okHttpClient from the BoxApiConnection subclasses
Refs: #1271
1 parent 6ea70f7 commit 8c67b7a

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

src/main/java/com/box/sdk/BoxCCGAPIConnection.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.eclipsesource.json.Json;
66
import com.eclipsesource.json.JsonObject;
77
import java.net.URL;
8+
import okhttp3.OkHttpClient;
89

910
/**
1011
* Creates and manages Client Credentials Grant API connection.
@@ -41,6 +42,14 @@ private BoxCCGAPIConnection(BoxConfig boxConfig) {
4142
super(boxConfig);
4243
}
4344

45+
/**
46+
* {@inheritDoc}
47+
*/
48+
@Override
49+
protected OkHttpClient.Builder modifyHttpClientBuilder(OkHttpClient.Builder httpClientBuilder) {
50+
return super.modifyHttpClientBuilder(httpClientBuilder);
51+
}
52+
4453
/**
4554
* Creates connection that authenticates as a Service Account
4655
*

src/main/java/com/box/sdk/BoxDeveloperEditionAPIConnection.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.text.SimpleDateFormat;
99
import java.util.Date;
1010
import java.util.List;
11+
import okhttp3.OkHttpClient;
1112
import org.jose4j.jws.AlgorithmIdentifiers;
1213
import org.jose4j.jws.JsonWebSignature;
1314
import org.jose4j.jwt.JwtClaims;
@@ -108,6 +109,14 @@ public BoxDeveloperEditionAPIConnection(String entityId, DeveloperEditionEntityT
108109
boxConfig.getJWTEncryptionPreferences(), accessTokenCache);
109110
}
110111

112+
/**
113+
* {@inheritDoc}
114+
*/
115+
@Override
116+
protected OkHttpClient.Builder modifyHttpClientBuilder(OkHttpClient.Builder httpClientBuilder) {
117+
return super.modifyHttpClientBuilder(httpClientBuilder);
118+
}
119+
111120
/**
112121
* Creates a new Box Developer Edition connection with enterprise token leveraging an access token cache.
113122
*

src/main/java/com/box/sdk/BoxTransactionalAPIConnection.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.net.MalformedURLException;
77
import java.net.URL;
88
import java.net.URLEncoder;
9+
import okhttp3.OkHttpClient;
910

1011
/**
1112
* Represents an authenticated transactional connection to the Box API.
@@ -27,6 +28,14 @@ public BoxTransactionalAPIConnection(String accessToken) {
2728
super.setAutoRefresh(false);
2829
}
2930

31+
/**
32+
* {@inheritDoc}
33+
*/
34+
@Override
35+
protected OkHttpClient.Builder modifyHttpClientBuilder(OkHttpClient.Builder httpClientBuilder) {
36+
return super.modifyHttpClientBuilder(httpClientBuilder);
37+
}
38+
3039
/**
3140
* Request a scoped transactional token.
3241
*

src/main/java/com/box/sdk/SharedLinkAPIConnection.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.box.sdk;
22

3+
import okhttp3.OkHttpClient;
4+
35
/**
46
* This API connection uses a shared link (along with an optional password) to authenticate with the Box API. It wraps a
57
* preexisting BoxAPIConnection in order to provide additional access to items that are accessible with a shared link.
@@ -24,6 +26,14 @@ public SharedLinkAPIConnection(BoxAPIConnection connection, String sharedLink, S
2426
this.sharedLinkPassword = sharedLinkPassword;
2527
}
2628

29+
/**
30+
* {@inheritDoc}
31+
*/
32+
@Override
33+
protected OkHttpClient.Builder modifyHttpClientBuilder(OkHttpClient.Builder httpClientBuilder) {
34+
return super.modifyHttpClientBuilder(httpClientBuilder);
35+
}
36+
2737
@Override
2838
public long getExpires() {
2939
return this.wrappedConnection.getExpires();

0 commit comments

Comments
 (0)