Use plugin ClassLoader for the resteasy client instead of the uberClassLoader (Fixes #407)

This commit is contained in:
Robin Müller 2016-09-13 22:58:33 +02:00
parent 29f34ad33a
commit df36214d2d
1 changed files with 6 additions and 2 deletions

View File

@ -31,6 +31,8 @@ import org.jboss.resteasy.spi.ResteasyProviderFactory;
import org.jenkinsci.plugins.plaincredentials.StringCredentials;
import javax.annotation.Nullable;
import javax.annotation.Priority;
import javax.ws.rs.Priorities;
import javax.ws.rs.client.ClientRequestContext;
import javax.ws.rs.client.ClientRequestFilter;
import javax.ws.rs.client.ClientResponseContext;
@ -90,8 +92,8 @@ public class GitLabClientBuilder {
.register(new LoggingFilter())
.build().target(gitlabHostUrl)
.proxyBuilder(GitLabApi.class)
.classloader(Jenkins.getInstance().getPluginManager().uberClassLoader)
.build();
.classloader(GitLabApi.class.getClassLoader())
.build();
}
public static GitLabApi buildClient(GitLabConnection connection) {
@ -130,6 +132,7 @@ public class GitLabClientBuilder {
throw new IllegalStateException("No credentials found for credentialsId: " + apiTokenId);
}
@Priority(Priorities.HEADER_DECORATOR)
private static class ApiHeaderTokenFilter implements ClientRequestFilter {
private final String gitlabApiToken;
@ -142,6 +145,7 @@ public class GitLabClientBuilder {
}
}
@Priority(Priorities.USER)
private static class LoggingFilter implements ClientRequestFilter, ClientResponseFilter {
@Override
public void filter(ClientRequestContext context) throws IOException {