Interface RequestHeaders
public interface RequestHeaders
The interface defining the HTTP headers that can be provided to
HttpOperation
. The headers can be used for example to correlate
multiple operations in the backend: a header with an identifier can be provided to the
HttpOperation
, and the header will be included in the HTTP request. If the identifier
can be associated with a more general operation (like a user enrollment), the backend
will be able to link the requests made by the SDK with that more generic operation.
This interface tracks header values line-by-line. A field with multiple comma-separated values on the same line will be treated as a field with a single value by this class. It is the caller's responsibility to detect and split on commas if their field permits multiple values. This simplifies use of single-valued fields whose values routinely contain commas, such as dates.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic RequestHeaders
Creates aRequestHeaders
fromString
varargs.static RequestHeaders
Creates aRequestHeaders
objects from aMap
.static RequestHeaders
createFromMultimap
(Map<String, List<String>> headers) Creates aRequestHeaders
objects from a multimap.A list containing the name of the headers and the associated values.
-
Method Details
-
namesAndValues
A list containing the name of the headers and the associated values. The even indexes contain the name of the header and the odd indexes the value. The total size is guaranteed to be an even number.For example:
"Accept","text/html","Accept","application/xhtml+xml"
- Returns:
- the list with the header names and values
-
create
Creates aRequestHeaders
objects from aMap
. The keys of theMap
are the header names and the values, the header values. The SDK will not do any processing of the provided values and will send the headers as provided. If you want to send multivalued headers in separate headers, use eithercreate(String...)
orcreateFromMultimap(Map)
.- Parameters:
headers
- the headers- Returns:
- a
RequestHeaders
object
-
create
Creates aRequestHeaders
fromString
varargs. The even indexes contain the name of the header and the odd indexes the value. The total size of the varargs must be an even number.For example:
RequestHeaders.create("mycustomheader", "value1, "mycustomheader", "value2");
- Parameters:
nameAndValues
- the names and values of the headers- Returns:
- a
RequestHeaders
object
-
createFromMultimap
Creates aRequestHeaders
objects from a multimap. The keys of theMap
are the header names and the values, the header values.- Parameters:
headers
- the headers as a multimap- Returns:
- a
RequestHeaders
object
-