HeaderValueWithParameters

abstract class HeaderValueWithParameters

Represents a header value that consist of content followed by parameters. Useful for headers such as Content-Type, Content-Disposition and so on.

Constructors

<init>

HeaderValueWithParameters(
    content: String,
    parameters: List<HeaderValueParam> = emptyList())

Represents a header value that consist of content followed by parameters. Useful for headers such as Content-Type, Content-Disposition and so on.

Properties

content

val content: String

header’s content without parameters

parameters

val parameters: List<HeaderValueParam>

Functions

parameter

fun parameter(name: String): String?

The first value for the parameter with name comparing case-insensitively or null if no such parameters found

toString

open fun toString(): String

Companion Object Functions

parse

fun <R> parse(
    value: String,
    init: (String, List<HeaderValueParam>) -> R
): R

Parse header with parameter and pass it to init function to instantiate particular type

Extension Functions

charset

fun HeaderValueWithParameters.charset(): Charset?

Extracts a Charset value from the given Content-Type, Content-Disposition or similar header value.

Inheritors

ContentDisposition

class ContentDisposition : HeaderValueWithParameters

Represents Content-Disposition header value

ContentType

class ContentType : HeaderValueWithParameters

Represents a value for a Content-Type header.

LinkHeader

class LinkHeader : HeaderValueWithParameters

Represents a Link header value as per RFC 5988