From 842bace0ac9b84b6ac0a269520746a0f8e34a094 Mon Sep 17 00:00:00 2001 From: Pierre LEGER Date: Sun, 1 Nov 2015 17:15:55 +0100 Subject: [PATCH] SWS-924 Mime header : Manage multiple keys with different values Correction for multiple keys with different values in HTTP Response. Before, in response of mimeheader: - cookie: value2 - cookie: value2 Now : - cookie: value1 - cookie: value2 Issue: SWS-924 --- .../ws/transport/http/HttpUrlConnection.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/spring-ws-core/src/main/java/org/springframework/ws/transport/http/HttpUrlConnection.java b/spring-ws-core/src/main/java/org/springframework/ws/transport/http/HttpUrlConnection.java index 23ddf1fa..f461b2e6 100644 --- a/spring-ws-core/src/main/java/org/springframework/ws/transport/http/HttpUrlConnection.java +++ b/spring-ws-core/src/main/java/org/springframework/ws/transport/http/HttpUrlConnection.java @@ -22,10 +22,11 @@ import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URI; import java.net.URISyntaxException; -import java.util.ArrayList; import java.util.Collections; +import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Set; import org.springframework.util.Assert; @@ -102,7 +103,7 @@ public class HttpUrlConnection extends AbstractHttpSenderConnection { @Override public Iterator getResponseHeaderNames() throws IOException { - List headerNames = new ArrayList(); + Set headerNames = new HashSet(); // Header field 0 is the status line, so we start at 1 int i = 1; while (true) { @@ -118,13 +119,12 @@ public class HttpUrlConnection extends AbstractHttpSenderConnection { @Override public Iterator getResponseHeaders(String name) throws IOException { - String headerField = connection.getHeaderField(name); - if (headerField == null) { - return Collections.emptyList().iterator(); - } - else { - Set tokens = StringUtils.commaDelimitedListToSet(headerField); - return tokens.iterator(); + Map> mapHeader = connection.getHeaderFields(); + List listHeaderValues = mapHeader.get(name); + if (listHeaderValues == null) { + return Collections.emptyList().iterator(); + } else { + return listHeaderValues.iterator(); } }