// Eliminate duplicate attributes. The first occurrence takes precedence
// See RFC2965: 3.2 Origin Server Role
final Map<String, NameValuePair> attribmap =
new HashMap<String, NameValuePair>(attribs.length);
for (int j = attribs.length - 1; j >= 0; j--) {
final NameValuePair param = attribs[j];
attribmap.put(param.getName().toLowerCase(Locale.ENGLISH), param);
}
for (final Map.Entry<String, NameValuePair> entry : attribmap.entrySet()) {
final NameValuePair attrib = entry.getValue();
final String s = attrib.getName().toLowerCase(Locale.ENGLISH);
cookie.setAttribute(s, attrib.getValue());
final CookieAttributeHandler handler = findAttribHandler(s);
if (handler != null) {
handler.parse(cookie, attrib.getValue());
}
}
cookies.add(cookie);
}
return cookies;