HeadersBuilder

class HeadersBuilder : StringValuesBuilder

Constructors

<init>

HeadersBuilder(size: Int = 8)

Inherited Properties

built

var built: Boolean

caseInsensitiveName

val caseInsensitiveName: Boolean

values

Functions

build

fun build(): Headers

Inherited Functions

append

fun append(name: String, value: String): Unit

appendAll

fun appendAll(stringValues: StringValues): Unit
fun appendAll(name: String, values: Iterable<String>): Unit

appendMissing

fun appendMissing(stringValues: StringValues): Unit
fun appendMissing(
    name: String,
    values: Iterable<String>
): Unit

clear

fun clear(): Unit

contains

operator fun contains(name: String): Boolean
fun contains(name: String, value: String): Boolean

entries

fun entries(): Set<Entry<String, List<String>>>

get

operator fun get(name: String): String?

getAll

fun getAll(name: String): List<String>?

isEmpty

fun isEmpty(): Boolean

names

fun names(): MutableSet<String>

remove

fun remove(name: String): Unit
fun remove(name: String, value: String): Boolean

removeKeysWithNoEntries

fun removeKeysWithNoEntries(): Unit

set

operator fun set(name: String, value: String): Unit

Extension Functions

append

fun StringValuesBuilder.append(
    name: String,
    value: HeaderValueWithParameters
): Unit

Append formatted header value to the builder

appendAll

Append all values from the specified builder

appendFiltered

fun StringValuesBuilder.appendFiltered(
    source: StringValues,
    keepEmpty: Boolean = false,
    predicate: (String, String) -> Boolean
): Unit

Append values from source filtering values by the specified predicate

cacheControl

fun HeadersBuilder.cacheControl(value: CacheControl): Unit

Append Cache-Control HTTP header value

contentRange

fun HeadersBuilder.contentRange(
    range: LongRange?,
    fullLength: Long? = null,
    unit: String = RangeUnits.Bytes.unitToken
): Unit

Append ‘Content-Range` header with specified range and fullLength

etag

fun HeadersBuilder.etag(entityTag: String): Unit

Set E-Tag header

expires

fun HeadersBuilder.expires(expires: LocalDateTime): Unit

Set ‘Expires` header value from expires

lastModified

fun HeadersBuilder.lastModified(
    dateTime: ZonedDateTime
): Unit

Set ‘Last-Modified` header value from dateTime