I see this committed to SVN:
Map headersMap = (Map) context.getContextualProperty(HTTP_HEADERS);
if (headersMap != null) {
for (Iterator iter = headersMap.entrySet().iterator(); iter.hasNext()
{
Map.Entry entry = (Entry) iter.next();
postMethod.addRequestHeader(entry.getKey().toString(), entry.getValue().toString());
}
}
I like the Object.toString()! That could come in handy.
Is the support for several headers (so checking for instanceof Object[]) with the same name not desirable?
Just curious if the String[] idea was a bad one.
This change is important for the project I am currently working on so I took a stab at a patch for it.
This patch will allow custom HTTP headers to be added as contextual properties. For example, the developer could set the header(s) like this:
this would produce the following headers:
The map can have either (String, String) or (String, String[]) since we are allowed to have headers with the same name.