Package io.helidon.common.http
Interface Headers
-
- All Superinterfaces:
Parameters
- All Known Subinterfaces:
RequestHeaders,ResponseHeaders
public interface Headers extends Parameters
ExtendsParametersinterface 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 unmodifiableListof 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 unmodifiableListof 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 unmodifiableListof 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:
allin interfaceParameters- Parameters:
headerName- the header name- Returns:
- a
Listof values with zero or greater size - Throws:
NullPointerException- ifheaderNameisnull- See Also:
value(String),values(String)
-
value
default Optional<String> value(String headerName)
Returns a header value as a singleStringpotentially concatenated using comma character fromallheader 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- ifheaderNameisnull- See Also:
all(String),values(String)
-
values
default List<String> values(String headerName)
Returns an unmodifiableListof 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
headerNamewhere 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
Listof values with zero or greater size, nevernull - Throws:
NullPointerException- ifheaderNameisnull- See Also:
all(String),value(String)
-
-