ApplicationResponse

interface ApplicationResponse

A server's response. To learn how to send responses inside route handlers, see Sending responses.

See also

Functions

Link copied to clipboard
abstract fun push(builder: ResponsePushBuilder)

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

Link copied to clipboard
abstract fun status(): <ERROR CLASS>?

Returns a response status code or null if a status code is not set.

abstract fun status(value: <ERROR CLASS>)

Specifies a status code for a response.

Properties

Link copied to clipboard
abstract val call: ApplicationCall

An ApplicationCall instance this ApplicationResponse is attached to.

Link copied to clipboard
abstract val cookies: ResponseCookies

Provides access to cookies for this response.

Link copied to clipboard
abstract val headers: ResponseHeaders

Provides access to headers for the current response.

Link copied to clipboard
abstract val isCommitted: Boolean

Indicates that this response is already committed and no further changes are allowed.

Link copied to clipboard
abstract val pipeline: ApplicationSendPipeline

A pipeline for sending content.

Inheritors

Link copied to clipboard

Extensions

Link copied to clipboard
fun ApplicationResponse.cacheControl(value: <ERROR CLASS>)

Appends the Cache-Control header with the specified value to a response.

Link copied to clipboard
fun ApplicationResponse.contentRange(range: LongRange?, fullLength: Long? = null, unit: <ERROR CLASS>)
fun ApplicationResponse.contentRange(range: LongRange?, fullLength: Long? = null, unit: String = RangeUnits.Bytes.unitToken)

Appends the Content-Range header with the specified range and fullLength to a response.

Link copied to clipboard
fun ApplicationResponse.etag(value: String)

Appends the E-Tag header with the specified value to a response.

Link copied to clipboard
fun ApplicationResponse.expires(value: LocalDateTime)

Append response Expires HTTP header value

Link copied to clipboard
fun ApplicationResponse.header(name: String, value: String)
fun ApplicationResponse.header(name: String, value: Int)
fun ApplicationResponse.header(name: String, value: Long)

Appends a header with the specified name and value to a response.

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

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

Link copied to clipboard
fun ApplicationResponse.lastModified(dateTime: ZonedDateTime)

Append response Last-Modified HTTP header value from dateTime

Link copied to clipboard
fun ApplicationResponse.link(header: <ERROR CLASS>)

Append Link header to HTTP response

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

Append Link header to HTTP response with specified uri and rel

Link copied to clipboard
var ApplicationResponse.responseType: <ERROR CLASS>?

A type of response object that is passed in the respond function. Can be useful for custom serializations.