ApplicationResponse

interface ApplicationResponse

Represents server’s response

Properties

call

abstract val call: ApplicationCall

ApplicationCall instance this ApplicationResponse is attached to

cookies

abstract val cookies: ResponseCookies

Cookies for this response

headers

abstract val headers: ResponseHeaders

Headers for this response

pipeline

abstract val pipeline: ApplicationSendPipeline

Pipeline for sending content

Functions

push

abstract fun push(builder: ResponsePushBuilder): Unit

Produces HTTP/2 push from server to client or sets HTTP/1.x hint header or does nothing. Exact behaviour is up to engine implementation.

status

abstract fun status(): HttpStatusCode?

Currently set status code for this response, or null if none was set

abstract fun status(value: HttpStatusCode): Unit

Set status for this response

Extension Functions

cacheControl

fun ApplicationResponse.cacheControl(
    value: CacheControl
): Unit

Append response Cache-Control HTTP header value

contentRange

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

Append response Content-Range header with specified range and fullLength

etag

fun ApplicationResponse.etag(value: String): Unit

Append response E-Tag HTTP header value

expires

fun ApplicationResponse.expires(value: LocalDateTime): Unit

Append response Expires HTTP header value

header

fun ApplicationResponse.header(
    name: String,
    value: String
): Unit

Append HTTP response header with string value

fun ApplicationResponse.header(
    name: String,
    value: Int
): Unit

Append HTTP response header with integer numeric value

fun ApplicationResponse.header(
    name: String,
    value: Long
): Unit

Append HTTP response header with long integer numeric value

fun ApplicationResponse.header(
    name: String,
    date: Temporal
): Unit

Append HTTP response header with temporal date (date, time and so on)

lastModified

fun ApplicationResponse.lastModified(
    dateTime: ZonedDateTime
): Unit

Append response Last-Modified HTTP header value from dateTime

link

fun ApplicationResponse.link(header: LinkHeader): Unit

Append Link header to HTTP response

fun ApplicationResponse.link(
    uri: String,
    vararg rel: String
): Unit

Append Link header to HTTP response with specified uri and rel

Inheritors

BaseApplicationResponse

abstract class BaseApplicationResponse : ApplicationResponse

Base class for implementing an ApplicationResponse

RoutingApplicationResponse

class RoutingApplicationResponse : ApplicationResponse

Represents an application response being handled by Routing