* @see #getDateHeader
* @see #getIntHeader
*/
@SuppressWarnings("unchecked")
public void addHeader(String name, Object value) {
HeaderValueCollection header = HeaderValueCollection.getByName(this.headers, name);
if (value == null)
throw new IllegalArgumentException("Header value must not be null");
if (header == null) {
header = new HeaderValueCollection();
this.headers.put(name, header);
}
if (value instanceof Collection) {
header.addValues((Collection<Object>) value);
} else if (value.getClass().isArray()) {
header.addValueArray(value);
} else {
header.addValue(value);
}
}