metadata.put("HEADER", props);
Iterator i = mimeHeaders.getAllHeaders();
while (i.hasNext())
{
MimeHeader header = (MimeHeader)i.next();
String currentValue = props.getProperty(header.getName());
/*
* Coalesce multiple headers into one
*
* From HTTP/1.1 RFC 2616:
*
* Multiple message-header fields with the same field-name MAY be
* present in a message if and only if the entire field-value for that
* header field is defined as a comma-separated list [i.e., #(values)].
* It MUST be possible to combine the multiple header fields into one
* "field-name: field-value" pair, without changing the semantics of
* the message, by appending each subsequent field-value to the first,
* each separated by a comma.
*/
if (currentValue != null)
{
props.put(header.getName(), currentValue + "," + header.getValue());
}
else
{
props.put(header.getName(), header.getValue());
}
}
}