for (Map.Entry<String, List<String>> header : headerFields.entrySet()) {
if ("Set-Cookie".equals(header.getKey())) {
List<String> value = header.getValue();
for (String cookie : value) {
//since this processing is per header, there is only one cookie to parse
Cookie nettCookie = new CookieDecoder().decode(cookie).iterator().next();
HttpCookie c = new HttpCookie(nettCookie.getName(),nettCookie.getValue());
cookies.add(c);
}
}
}