changed to multivaluedmap
@@ -149,6 +149,8 @@ import javax.ws.rs.client.Invocation;
import javax.ws.rs.client.ResponseProcessingException;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.GenericType;
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import org.apache.commons.compress.utils.IOUtils;
import org.apache.http.client.config.RequestConfig;
@@ -660,17 +662,20 @@ public class DefaultDockerClient implements DockerClient, Closeable {
private void containerAction(final String containerId, final String action)
throws DockerException, InterruptedException {
- containerAction(containerId, action, new ArrayList<Map.Entry<String,String>>());
+ containerAction(containerId, action, new MultivaluedHashMap<String, String>());
}
private void containerAction(final String containerId, final String action,
- final List<Map.Entry<String,String>> queryParameters)
+ final MultivaluedMap<String, String> queryParameters)
throws DockerException, InterruptedException {
try {
final WebTarget resource = resource()
.path("containers").path(containerId).path(action);
- for (Map.Entry<String, String> queryParameter : queryParameters) {
- resource.queryParam(queryParameter.getKey(), queryParameter.getValue());
+
+ for (Map.Entry<String, List<String>> queryParameter : queryParameters.entrySet()) {
+ for (String parameterValue : queryParameter.getValue()) {
+ resource.queryParam(queryParameter.getKey(), parameterValue);
+ }
}
request(POST, resource, resource.request());
} catch (DockerRequestException e) {
@@ -707,12 +712,11 @@ public class DefaultDockerClient implements DockerClient, Closeable {
throws DockerException, InterruptedException {
checkNotNull(containerId, "containerId");
checkNotNull(secondsToWaitBeforeRestart, "secondsToWait");
- Map.Entry<String, String> restartParam =
- new AbstractMap.SimpleEntry<String, String>("t",
- String.valueOf(secondsToWaitBeforeRestart));
- List<Map.Entry<String, String>> queryParameterList = new ArrayList<>();
- queryParameterList.add(restartParam);
- containerAction(containerId, "restart", queryParameterList);
+
+ MultivaluedMap<String, String> queryParameters = new MultivaluedHashMap<>();
+ queryParameters.add("t", String.valueOf(secondsToWaitBeforeRestart));
+
+ containerAction(containerId, "restart", queryParameters);
}
@Override
@@ -725,11 +729,11 @@ public class DefaultDockerClient implements DockerClient, Closeable {
public void killContainer(final String containerId, final Signal signal)
throws DockerException, InterruptedException {
checkNotNull(containerId, "containerId");
- Map.Entry<String, String> signalParam =
- new AbstractMap.SimpleEntry<String, String>("signal", signal.getName());
- List<Map.Entry<String, String>> queryParameterList = new ArrayList<>();
- queryParameterList.add(signalParam);
- containerAction(containerId, "kill", queryParameterList);
+
+ MultivaluedMap<String, String> queryParameters = new MultivaluedHashMap<>();
+ queryParameters.add("signal", signal.getName());
+
+ containerAction(containerId, "kill", queryParameters);
}
@Override
