public final class HttpHeader extends Object
A header is defined by:
| Modifier and Type | Class and Description |
|---|---|
static class |
HttpHeader.Builder
Builder for
HttpHeader. |
| Modifier and Type | Method and Description |
|---|---|
static HttpHeader.Builder |
builder(String name)
Create builder for
HttpHeader. |
boolean |
equals(Object o) |
String |
getFirstValue()
Get first value of header.
|
String |
getLastValue()
Get last value of header.
|
String |
getName()
Get header name.
|
List<String> |
getValues()
Get header values (returned list is not modifiable).
|
int |
hashCode() |
static HttpHeader |
header(String name,
Collection<String> values)
Create a header with multiple values.
|
static HttpHeader |
header(String name,
String value)
Create a header with a single value.
|
static HttpHeader |
of(String name,
Collection<String> values)
Create a header with multiple values.
|
static HttpHeader |
of(String name,
String value)
Create a header with a single value.
|
String |
serialize()
Serialize header as it should appear in raw HTTP request.
|
String |
serializeValues()
Serialize header values using the default separator.
|
String |
toString() |
public static HttpHeader header(String name, String value)
name - Header name, must not be blank.value - Header value.NullPointerException - If name or value are null.IllegalArgumentException - If name is blank.public static HttpHeader header(String name, Collection<String> values)
name - Header name.values - Header values, must not be empty.NullPointerException - If name or one of values are null.IllegalArgumentException - If name is blank.public static HttpHeader of(String name, String value)
name - Header name, must not be blank.value - Header value.NullPointerException - If name or value are null.IllegalArgumentException - If name is blank.public static HttpHeader of(String name, Collection<String> values)
name - Header name.values - Header values, must not be empty.NullPointerException - If name or one of values are null.IllegalArgumentException - If name is blank.public static HttpHeader.Builder builder(String name)
HttpHeader.name - Header name.public String getName()
public List<String> getValues()
public String getFirstValue()
public String getLastValue()
getFirstValue().public String serializeValues()
public String serialize()
Copyright © 2019. All rights reserved.