Added HttpMessage.setHeader(String, String)
This commit is contained in:
parent
f183b3d965
commit
cd5f5732a2
@ -60,6 +60,16 @@ public class DefaultHttpMessage implements HttpMessage {
|
||||
headers.get(name).add(value);
|
||||
}
|
||||
|
||||
public void setHeader(final String name, final String value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException("value");
|
||||
}
|
||||
|
||||
List<String> values = new ArrayList<String>(1);
|
||||
values.add(value);
|
||||
headers.put(name, values);
|
||||
}
|
||||
|
||||
public void setHeader(final String name, final List<String> values) {
|
||||
if (values == null || values.size() == 0) {
|
||||
throw new NullPointerException("no values present");
|
||||
|
@ -49,6 +49,8 @@ public interface HttpMessage {
|
||||
|
||||
void addHeader(String name, String value);
|
||||
|
||||
void setHeader(String name, String value);
|
||||
|
||||
void setHeader(String name, List<String> values);
|
||||
|
||||
void removeHeader(String name);
|
||||
|
Loading…
Reference in New Issue
Block a user