Skip to content

Commit 3ceeb2f

Browse files
committed
- Renamed private class ResteasyClientBuilder to HttpCredsResteasyClientBuilderImpl to avoid duplicate names and better reflect functionality of class
- Removed getHttpEngine as it holdover from forking from GitLab and their RESTful API version 3
1 parent 6cb10c9 commit 3ceeb2f

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

src/main/java/com/gitee/jenkins/gitee/api/impl/ResteasyGiteeClientBuilder.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public final GiteeClient buildClient(String url, String apiToken, boolean ignore
9292
}
9393

9494
private GiteeClient buildClient(String url, String apiToken, ProxyConfiguration httpProxyConfig, boolean ignoreCertificateErrors, int connectionTimeout, int readTimeout) {
95-
ResteasyClientBuilder builder = (ResteasyClientBuilder) ClientBuilder.newBuilder();
95+
HttpCredsResteasyClientBuilderImpl builder = (HttpCredsResteasyClientBuilderImpl) ClientBuilder.newBuilder();
9696

9797
if (ignoreCertificateErrors) {
9898
builder.hostnameVerification(HostnameVerificationPolicy.ANY);
@@ -230,27 +230,17 @@ public void filter(ClientRequestContext clientRequestContext) {
230230
}
231231
}
232232

233-
private static class ResteasyClientBuilder extends ResteasyClientBuilderImpl {
233+
private static class HttpCredsResteasyClientBuilderImpl extends ResteasyClientBuilderImpl {
234234
private CredentialsProvider proxyCredentials;
235235

236236
@SuppressWarnings("UnusedReturnValue")
237-
ResteasyClientBuilder defaultProxy(String hostname, int port, final String scheme, String username, String password) {
237+
HttpCredsResteasyClientBuilderImpl defaultProxy(String hostname, int port, final String scheme, String username, String password) {
238238
super.defaultProxy(hostname, port, scheme);
239239
if (username != null && password != null) {
240240
proxyCredentials = new BasicCredentialsProvider();
241241
proxyCredentials.setCredentials(new AuthScope(hostname, port), new UsernamePasswordCredentials(username, password));
242242
}
243243
return this;
244244
}
245-
246-
@SuppressWarnings("deprecation")
247-
@Override
248-
public ClientHttpEngine getHttpEngine() {
249-
ApacheHttpClient43Engine httpEngine = (ApacheHttpClient43Engine) super.getHttpEngine();
250-
if (proxyCredentials != null) {
251-
((DefaultHttpClient) httpEngine.getHttpClient()).setCredentialsProvider(proxyCredentials);
252-
}
253-
return httpEngine;
254-
}
255245
}
256246
}

0 commit comments

Comments
 (0)