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
Conversation
# 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
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(); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 exec
s
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)
Adds a new, Apache HttpClient 5 based transport (without Jersey) that implements
DockerHttpClient
and supports input hijacking 🎉