Package io.helidon.common.http
Interface Headers
-
- All Superinterfaces:
Parameters
- All Known Subinterfaces:
RequestHeaders
,ResponseHeaders
public interface Headers extends Parameters
ExtendsParameters
interface by adding methods convenient for HTTP headers.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description List<String>
all(String headerName)
Returns an unmodifiableList
of all header fields - each element represents a value of a single header field in the request.default Optional<String>
value(String headerName)
default List<String>
values(String headerName)
Returns an unmodifiableList
of all comma separated header value parts - Such segmentation is NOT valid for all header semantics, however it is very common.-
Methods inherited from interface io.helidon.common.http.Parameters
add, add, addAll, computeIfAbsent, computeSingleIfAbsent, first, put, put, putAll, putIfAbsent, putIfAbsent, remove, toMap
-
-
-
-
Method Detail
-
all
List<String> all(String headerName)
Returns an unmodifiableList
of all header fields - each element represents a value of a single header field in the request. Consider to usevalue(String)
orvalues(String)
method instead.Always returns a List, which may be empty if the parameter is not present.
- Specified by:
all
in interfaceParameters
- Parameters:
headerName
- the header name- Returns:
- a
List
of values with zero or greater size - Throws:
NullPointerException
- ifheaderName
isnull
- See Also:
value(String)
,values(String)
-
value
default Optional<String> value(String headerName)
Returns a header value as a singleString
potentially concatenated using comma character fromall
header fields.Accordingly to RFC2616, Message Headers:
Multiple message-header fields with the same field-name MAY be present in a message if and only if the entire field-value for that header field is defined as a comma-separated list [i.e., #(values)]. It MUST be possible to combine the multiple header fields into one "field-name: field-value" pair, without changing the semantics of the message, by appending each subsequent field-value to the first, each separated by a comma.
- Parameters:
headerName
- the header name- Returns:
- all header values concatenated using comma separator
- Throws:
NullPointerException
- ifheaderName
isnull
- See Also:
all(String)
,values(String)
-
values
default List<String> values(String headerName)
Returns an unmodifiableList
of all comma separated header value parts - Such segmentation is NOT valid for all header semantics, however it is very common. Refer to actual header semantics standard/description before use.Result is composed from all header fields with requested
headerName
where each header value is tokenized by a comma character. Tokenization respects value quoting by double-quote character.Always returns a List, which may be empty if the parameter is not present.
- Parameters:
headerName
- the header name- Returns:
- a
List
of values with zero or greater size, nevernull
- Throws:
NullPointerException
- ifheaderName
isnull
- See Also:
all(String)
,value(String)
-
-