ApplicationCall

interface ApplicationCall

A single act of communication between a client and server.

See also

Properties

Link copied to clipboard
abstract val application: Application

An application being called.

Link copied to clipboard
abstract val attributes: <ERROR CLASS>

Attributes attached to this call.

Link copied to clipboard
abstract val parameters: <ERROR CLASS>

Parameters associated with this call.

Link copied to clipboard
abstract val request: ApplicationRequest

An ApplicationRequest that is a client request.

Link copied to clipboard
abstract val response: ApplicationResponse

An ApplicationResponse that is a server response.

Inheritors

Link copied to clipboard

Extensions

Link copied to clipboard
fun ApplicationCall.defaultTextContentType(contentType: <ERROR CLASS>?): <ERROR CLASS>

Creates a default ContentType based on the given contentType and current call.

Link copied to clipboard
val ApplicationCall.isHandled: Boolean

Indicates if a response is sent.

Link copied to clipboard

Returns MutableOriginConnectionPoint associated with this call

Link copied to clipboard
fun ApplicationCall.push(pathAndQuery: String)
fun ApplicationCall.push(encodedPath: String, encodedParameters: <ERROR CLASS>)

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.

fun ApplicationCall.push(block: ResponsePushBuilder.() -> Unit)

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

Link copied to clipboard
inline suspend fun <T : Any> ApplicationCall.receive(): T
suspend fun <T : Any> ApplicationCall.receive(type: KClass<T>): T
suspend fun <T : Any> ApplicationCall.receive(typeInfo: <ERROR CLASS>): T

Receives content for this request.

Link copied to clipboard
inline suspend fun ApplicationCall.receiveChannel(): <ERROR CLASS>

Receives channel content for this call.

Link copied to clipboard
inline suspend fun ApplicationCall.receiveMultipart(): <ERROR CLASS>

Receives multipart data for this call.

Link copied to clipboard
inline suspend fun <T : Any> ApplicationCall.receiveOrNull(): T?
suspend fun <T : Any> ApplicationCall.receiveOrNull(typeInfo: <ERROR CLASS>): T?
suspend fun <T : Any> ApplicationCall.receiveOrNull(type: KClass<T>): T?

Receives content for this request.

Link copied to clipboard
inline suspend fun ApplicationCall.receiveParameters(): <ERROR CLASS>

Receives form parameters for this call.

Link copied to clipboard
inline suspend fun ApplicationCall.receiveStream(): InputStream

Receives stream content for this call.

Link copied to clipboard
inline suspend fun ApplicationCall.receiveText(): String

Receives incoming content for this call as String.

Link copied to clipboard
var ApplicationCall.receiveType: <ERROR CLASS>

The TypeInfo recorded from the last call.receive() call.

Link copied to clipboard
fun ApplicationCall.resolveResource(path: String, resourcePackage: String? = null, classLoader: ClassLoader = application.environment.classLoader, mimeResolve: (String) -> ContentType = { ContentType.defaultForFileExtension(it) }): OutgoingContent?
Link copied to clipboard
@JvmName(name = "respondWithType")
inline suspend fun <T : Any> ApplicationCall.respond(message: T)

Sends a message as a response.

@JvmName(name = "respondWithType")
inline suspend fun <T : Any> ApplicationCall.respond(status: <ERROR CLASS>, message: T)

Sends a message as a response with the specified status code.

Link copied to clipboard
suspend fun ApplicationCall.respondBytes(contentType: <ERROR CLASS>? = null, status: <ERROR CLASS>? = null, provider: suspend () -> ByteArray)

Responds to a client with a raw bytes response, using the specified provider to build a byte array.

suspend fun ApplicationCall.respondBytes(bytes: ByteArray, contentType: <ERROR CLASS>? = null, status: <ERROR CLASS>? = null, configure: <ERROR CLASS>.() -> Unit = {})

Responds to a client with a raw bytes response, using specified bytes.

Link copied to clipboard
suspend fun ApplicationCall.respondBytesWriter(contentType: <ERROR CLASS>? = null, status: <ERROR CLASS>? = null, contentLength: Long? = null, producer: suspend <ERROR CLASS>.() -> Unit)

Respond with a binary content producer.

Link copied to clipboard
suspend fun ApplicationCall.respondFile(baseDir: File, fileName: String, configure: OutgoingContent.() -> Unit = {})

Responds to a client with a contents of a file with the name fileName in the baseDir folder

suspend fun ApplicationCall.respondFile(file: File, configure: OutgoingContent.() -> Unit = {})

Responds to a client with a contents of a file

Link copied to clipboard
suspend fun ApplicationCall.respondOutputStream(contentType: ContentType? = null, status: HttpStatusCode? = null, producer: suspend OutputStream.() -> Unit)
suspend fun ApplicationCall.respondOutputStream(contentType: ContentType? = null, status: HttpStatusCode? = null, contentLength: Long? = null, producer: suspend OutputStream.() -> Unit)

Respond with binary content producer.

Link copied to clipboard
suspend fun ApplicationCall.respondRedirect(url: String, permanent: Boolean = false)

Responds to a client with a 301 Moved Permanently or 302 Found redirect.

inline suspend fun ApplicationCall.respondRedirect(permanent: Boolean = false, block: <ERROR CLASS>.() -> Unit)

Responds to a client with a 301 Moved Permanently or 302 Found redirect. Unlike the other respondRedirect, it provides a way to build a URL based on current call using the block function.

Link copied to clipboard
suspend fun ApplicationCall.respondText(text: String, contentType: <ERROR CLASS>? = null, status: <ERROR CLASS>? = null, configure: <ERROR CLASS>.() -> Unit = {})

Responds to a client with a plain text response.

suspend fun ApplicationCall.respondText(contentType: <ERROR CLASS>? = null, status: <ERROR CLASS>? = null, provider: suspend () -> String)

Responds to a client with a plain text response, using the specified provider to build a text.

Link copied to clipboard
suspend fun ApplicationCall.respondTextWriter(contentType: ContentType? = null, status: HttpStatusCode? = null, writer: suspend Writer.() -> Unit)
suspend fun ApplicationCall.respondTextWriter(contentType: ContentType? = null, status: HttpStatusCode? = null, contentLength: Long? = null, writer: suspend Writer.() -> Unit)

Respond with text content writer.

Link copied to clipboard
inline fun ApplicationCall.url(block: <ERROR CLASS>.() -> Unit = {}): String

Creates an url using current call's schema, path and parameters as initial and then invokes block function on the url builder so amend parameters