ServletApplicationResponse

abstract class ServletApplicationResponse : 
    BaseApplicationResponse

Constructors

<init>

ServletApplicationResponse(
    call: ApplicationCall,
    servletResponse: HttpServletResponse)

Properties

completed

var completed: Boolean

headers

open val headers: ResponseHeaders

Headers for this response

servletResponse

val servletResponse: HttpServletResponse

Inherited Properties

bufferPool

open val bufferPool: ObjectPool<ByteBuffer>

ByteBuffer pool

call

open val call: ApplicationCall

ApplicationCall instance this ApplicationResponse is attached to

cookies

open val cookies: ResponseCookies

Cookies for this response

pipeline

Pipeline for sending content

Functions

createResponseJob

abstract fun createResponseJob(): ReaderJob

responseChannel

suspend fun responseChannel(): ByteWriteChannel

Get response output channel

setStatus

open fun setStatus(statusCode: HttpStatusCode): Unit

Set underlying engine’s response status

Inherited Functions

commitHeaders

fun commitHeaders(content: OutgoingContent): Unit

Commit header values and status and pass them to the underlying engine

push

open 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.

respondFromBytes

open suspend fun respondFromBytes(bytes: ByteArray): Unit

Respond with bytes content

respondFromChannel

open suspend fun respondFromChannel(
    readChannel: ByteReadChannel
): Unit

Respond from readChannel

respondNoContent

open suspend fun respondNoContent(content: NoContent): Unit

Process response with no content

respondOutgoingContent

open suspend fun respondOutgoingContent(
    content: OutgoingContent
): Unit

Process response outgoing content

respondUpgrade

abstract suspend fun respondUpgrade(
    upgrade: ProtocolUpgrade
): Unit

Process upgrade response

respondWriteChannelContent

open suspend fun respondWriteChannelContent(
    content: WriteChannelContent
): Unit

Process response content using OutgoingContent.WriteChannelContent.writeTo.

status

open fun status(): HttpStatusCode?

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

open 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

AsyncServletApplicationResponse

open class AsyncServletApplicationResponse : 
    ServletApplicationResponse,
    CoroutineScope