Skip to content

Commit 842bace

Browse files
pierre-legergregturn
authored andcommitted
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
1 parent 1c4b17e commit 842bace

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

spring-ws-core/src/main/java/org/springframework/ws/transport/http/HttpUrlConnection.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@
2222
import java.net.HttpURLConnection;
2323
import java.net.URI;
2424
import java.net.URISyntaxException;
25-
import java.util.ArrayList;
2625
import java.util.Collections;
26+
import java.util.HashSet;
2727
import java.util.Iterator;
2828
import java.util.List;
29+
import java.util.Map;
2930
import java.util.Set;
3031

3132
import org.springframework.util.Assert;
@@ -102,7 +103,7 @@ protected long getResponseContentLength() throws IOException {
102103

103104
@Override
104105
public Iterator<String> getResponseHeaderNames() throws IOException {
105-
List<String> headerNames = new ArrayList<String>();
106+
Set<String> headerNames = new HashSet<String>();
106107
// Header field 0 is the status line, so we start at 1
107108
int i = 1;
108109
while (true) {
@@ -118,13 +119,12 @@ public Iterator<String> getResponseHeaderNames() throws IOException {
118119

119120
@Override
120121
public Iterator<String> getResponseHeaders(String name) throws IOException {
121-
String headerField = connection.getHeaderField(name);
122-
if (headerField == null) {
123-
return Collections.<String>emptyList().iterator();
124-
}
125-
else {
126-
Set<String> tokens = StringUtils.commaDelimitedListToSet(headerField);
127-
return tokens.iterator();
122+
Map<String, List<String>> mapHeader = connection.getHeaderFields();
123+
List<String> listHeaderValues = mapHeader.get(name);
124+
if (listHeaderValues == null) {
125+
return Collections.<String>emptyList().iterator();
126+
} else {
127+
return listHeaderValues.iterator();
128128
}
129129
}
130130

0 commit comments

Comments
 (0)