Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Apache HttpClient 5 transport #1358

Merged
merged 39 commits into from Apr 7, 2020
Merged

Add Apache HttpClient 5 transport #1358

merged 39 commits into from Apr 7, 2020

Conversation

bsideup
Copy link
Member

@bsideup bsideup commented Apr 4, 2020

Adds a new, Apache HttpClient 5 based transport (without Jersey) that implements DockerHttpClient and supports input hijacking 🎉

# Conflicts:
#	docker-java-transport-common/src/main/java/com/github/dockerjava/transport/common/NamedPipeSocketFactory.java
#	docker-java-transport-okhttp/src/main/java/com/github/dockerjava/okhttp/OkDockerHttpClient.java
#	docker-java-transport-okhttp/src/main/java/com/github/dockerjava/okhttp/UnixSocketFactory.java
# Conflicts:
#	docker-java-transport-common/src/main/java/com/github/dockerjava/transport/common/NamedPipeSocketFactory.java
#	docker-java-transport-okhttp/src/main/java/com/github/dockerjava/okhttp/OkDockerHttpClient.java
#	docker-java-transport-okhttp/src/main/java/com/github/dockerjava/okhttp/UnixSocketFactory.java
@bsideup bsideup added this to the next milestone Apr 4, 2020
Comment on lines +49 to +69
class FakeFactory extends DelegatingDockerCmdExecFactory implements DockerClientConfigAware {

private DefaultDockerCmdExecFactory dockerCmdExecFactory;

@Override
public final DockerCmdExecFactory getDockerCmdExecFactory() {
return dockerCmdExecFactory;
}

@Override
public void init(DockerClientConfig dockerClientConfig) {
dockerCmdExecFactory = new DefaultDockerCmdExecFactory(
new ApacheDockerHttpClient.Factory()
.dockerClientConfig(dockerClientConfig)
.build(),
dockerClientConfig.getObjectMapper()
);
dockerCmdExecFactory.init(dockerClientConfig);
}
}
return new FakeFactory();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big deal but... why is there no standard factory class for this transport? I'm a bit unclear as to why there would be NettyDockerCmdExecFactory, JerseyDockerCmdExecFactory and OkHttpDockerCmdExecFactory but no corresponding one for this client.

Copy link
Member Author

@bsideup bsideup Apr 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okhttp's and jersey's DockerCmdExecFactory are deprecated (see #1351) in favour of their DockerHttpClient versions. I have not migrated Netty yet, but plan to.

Eventually, DockerCmdExecFactory will become an internal class of core, and all commands will share their execs

Since this PR adds a new module, there is no point in adding a deprecated type.

Also note that one can do withHttpClient(...) now instead of withDockerCmdExecFactory (deprecated)

@bsideup bsideup merged commit e4eb048 into master Apr 7, 2020
@bsideup bsideup deleted the httpclient5_transport branch April 7, 2020 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants