OutgoingContent

sealed class OutgoingContent

Information about the content to be sent to the peer, recognized by a client or server engine

Types

ByteArrayContent

abstract class ByteArrayContent : OutgoingContent

Variant of a OutgoingContent with payload represented as ByteArray

NoContent

abstract class NoContent : OutgoingContent

Variant of a OutgoingContent without a payload

ProtocolUpgrade

abstract class ProtocolUpgrade : OutgoingContent

Variant of a OutgoingContent for upgrading an HTTP connection

ReadChannelContent

abstract class ReadChannelContent : OutgoingContent

Variant of a OutgoingContent with payload read from ByteReadChannel

WriteChannelContent

abstract class WriteChannelContent : OutgoingContent

Variant of a OutgoingContent with payload written to ByteWriteChannel

Properties

contentLength

open val contentLength: Long?

Specifies content length in bytes for this resource.

contentType

open val contentType: ContentType?

Specifies ContentType for this resource.

headers

open val headers: Headers

Headers to set when sending this content

status

open val status: HttpStatusCode?

Status code to set when sending this content

Functions

getProperty

open fun <T : Any> getProperty(key: AttributeKey<T>): T?

Gets an extension property for this content

setProperty

open fun <T : Any> setProperty(
    key: AttributeKey<T>,
    value: T?
): Unit

Sets an extension property for this content

Extension Properties

caching

Gets or sets CacheControl instance as an extension property on this content

defaultVersions

val OutgoingContent.defaultVersions: List<Version>

Retrieves LastModified and ETag versions from this OutgoingContent headers

versions

Gets or sets list of Version instances as an extension property on this content

Extension Functions

toByteArray

suspend fun OutgoingContent.toByteArray(): ByteArray

toByteReadPacket

suspend fun OutgoingContent.toByteReadPacket(): ByteReadPacket

wrapHeaders

fun OutgoingContent.wrapHeaders(
    block: (Headers) -> Headers
): OutgoingContent

Generates a new OutgoingContent of the same abstract type but with OutgoingContent.headers transformed by the specified block.

Inheritors

ByteArrayContent

abstract class ByteArrayContent : OutgoingContent

Variant of a OutgoingContent with payload represented as ByteArray

NoContent

abstract class NoContent : OutgoingContent

Variant of a OutgoingContent without a payload

ProtocolUpgrade

abstract class ProtocolUpgrade : OutgoingContent

Variant of a OutgoingContent for upgrading an HTTP connection

ReadChannelContent

abstract class ReadChannelContent : OutgoingContent

Variant of a OutgoingContent with payload read from ByteReadChannel

WriteChannelContent

abstract class WriteChannelContent : OutgoingContent

Variant of a OutgoingContent with payload written to ByteWriteChannel