ktor-http / io.ktor.http.content / OutgoingContent

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

var OutgoingContent.caching: CachingOptions?

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

versions

var OutgoingContent.versions: List<Version>

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

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