Interface Header
- All Known Subinterfaces:
HeaderWriteable
- All Known Implementing Classes:
ContentDisposition
-
Method Summary
Modifier and TypeMethodDescriptionAll values of this header.allValues(boolean split) All values of this header.booleanchanging()Changing headers should not be cached, and their value should not be indexed (HTTP/2).Header name for the header.name()Name of the header as configured by user or as received on the wire.booleanSensitive headers should not be logged, or indexed (HTTP/2).default voidvalidate()Check validity of the header name and values.default byte[]Bytes of a single-valued header value.intNumber of values this header has.default Stringvalues()All values concatenated using a comma and a space.default voidwriteHttp1Header(BufferData buffer) Write the current header as an HTTP header to the provided buffer.Methods inherited from interface Value
as, as, as, asBoolean, asDouble, asInt, asLong, asOptional, asString, filter, flatMap, get, get, get, getBoolean, getDouble, getInt, getLong, getString, streamModifier and TypeMethodDescription<N> Value<N> as(GenericType<N> type) Convert this value to a different type using a mapper.<N> Value<N> Convert this value to a different type using a mapper.<N> Value<N> Convert thisValueto a different type using a mapper function.Boolean typed value.asDouble()Double typed value.asInt()Integer typed value.asLong()Long typed value.Typed value asOptional.asString()String typed value.If a value is present, and the value matches the given predicate, return anOptionaldescribing the value, otherwise return an emptyOptional.default <U> Optional<U> Apply the providedOptional-bearing mapping function to this value, return that result.get()Typed value.default <N> Nget(GenericType<N> type) Convert this value to a different type using a mapper.default <N> NConvert this value to a different type using a mapper.default booleanBoolean typed value.default doubleDouble typed value.default intgetInt()Integer typed value.default longgetLong()Long typed value.default StringString typed value.stream()If a value is present, returns a sequentialStreamcontaining only that value, otherwise returns an emptyStream.
-
Method Details
-
name
-
headerName
-
values
All values concatenated using a comma and a space.- Returns:
- all values joined by a comma
-
allValues
-
allValues
-
valueCount
int valueCount()Number of values this header has.- Returns:
- number of values (minimal number is 1)
-
sensitive
boolean sensitive()Sensitive headers should not be logged, or indexed (HTTP/2).- Returns:
- whether this header is sensitive
-
changing
boolean changing()Changing headers should not be cached, and their value should not be indexed (HTTP/2).- Returns:
- whether this header's value is changing often
-
valueBytes
default byte[] valueBytes()Bytes of a single-valued header value.Each character in the value is mapped to the byte with the same numeric value using
StandardCharsets.ISO_8859_1. Characters fromU+0080throughU+00FFtherefore represent opaque HTTP field-value octets; they are not interpreted as UTF-8 or as ISO-8859-1 text.- Returns:
- a new byte array containing the value bytes
- Throws:
IllegalArgumentException- if the value contains a character aboveU+00FF
-
writeHttp1Header
Write the current header as an HTTP header to the provided buffer.- Parameters:
buffer- buffer to write to (should be growing)
-
validate
Check validity of the header name and values.The name must be a non-empty HTTP token. Values may contain opaque octets represented by characters from
U+0080throughU+00FF; characters aboveU+00FFcannot be represented in an HTTP field value and are rejected.- Throws:
IllegalArgumentException- if the header name or a value is not valid
-