ApplicationCall

interface ApplicationCall

Represents a single act of communication between client and server.

Properties

application
Link copied to clipboard
abstract val application: Application
Application being called
attributes
Link copied to clipboard
abstract val attributes: Attributes
Attributes attached to this instance
parameters
Link copied to clipboard
abstract val parameters: Parameters
Parameters associated with this call
request
Link copied to clipboard
abstract val request: ApplicationRequest
Client request
response
Link copied to clipboard
abstract val response: ApplicationResponse
Server response

Inheritors

RoutingApplicationCall
Link copied to clipboard

Extensions

callId
Link copied to clipboard
val ApplicationCall.callId: String?
A call id that is retrieved or generated by CallId feature or null (this is possible if there is no call id provided and no generators configured or CallId feature is not installed)
defaultTextContentType
Link copied to clipboard
fun ApplicationCall.defaultTextContentType(contentType: ContentType?): ContentType
Creates a default ContentType based on the given contentType and current callIf contentType is null, it tries to fetch already set response header "Content-Type".
push
Link copied to clipboard
fun ApplicationCall.push(pathAndQuery: String)
Produces HTTP/2 push from server to client or sets HTTP/1.x hint header or does nothing.
fun ApplicationCall.push(encodedPath: String, parameters: Parameters)
Produces HTTP/2 push from server to client or sets HTTP/1.x hint header or does nothing.
fun ApplicationCall.push(block: ResponsePushBuilder.() -> Unit)
Produces HTTP/2 push from server to client or sets HTTP/1.
receive
Link copied to clipboard
inline suspend fun <T : Any> ApplicationCall.receive(): T
Receives content for this request.
suspend fun <T : Any> ApplicationCall.receive(type: KClass<T>): T
Receives content for this request.
suspend fun <T : Any> ApplicationCall.receive(type: KType): T
Receives content for this request.
receiveChannel
Link copied to clipboard
inline suspend fun ApplicationCall.receiveChannel(): ByteReadChannel
Receives channel content for this call.
receiveMultipart
Link copied to clipboard
inline suspend fun ApplicationCall.receiveMultipart(): MultiPartData
Receives multipart data for this call.
receiveOrNull
Link copied to clipboard
inline suspend fun <T : Any> ApplicationCall.receiveOrNull(): T?
Receives content for this request.
suspend fun <T : Any> ApplicationCall.receiveOrNull(type: KType): T?
Receives content for this request.
suspend fun <T : Any> ApplicationCall.receiveOrNull(type: KClass<T>): T?
Receives content for this request.
receiveParameters
Link copied to clipboard
inline suspend fun ApplicationCall.receiveParameters(): Parameters
Receives form parameters for this call.
receiveStream
Link copied to clipboard
inline suspend fun ApplicationCall.receiveStream(): InputStream
Receives stream content for this call.
receiveText
Link copied to clipboard
inline suspend fun ApplicationCall.receiveText(): String
Receives incoming content for this call as String.
resolveResource
Link copied to clipboard
fun ApplicationCall.resolveResource(path: String, resourcePackage: String? = null, classLoader: ClassLoader = application.environment.classLoader, mimeResolve: (String) -> ContentType = { ContentType.defaultForFileExtension(it) }): OutgoingContent?
respond
Link copied to clipboard
@JvmName(name = respondWithType)
inline suspend fun <T : Any> ApplicationCall.respond(message: T)
Sends a message as a response
inline suspend fun ApplicationCall.respond(message: Any)
Sends a message as a response
@JvmName(name = respondWithType)
inline suspend fun <T : Any> ApplicationCall.respond(status: HttpStatusCode, message: T)
Sets status and sends a message as a response
inline suspend fun ApplicationCall.respond(status: HttpStatusCode, message: Any)
Sets status and sends a message as a response
respondBytes
Link copied to clipboard
suspend fun ApplicationCall.respondBytes(contentType: ContentType? = null, status: HttpStatusCode? = null, provider: suspend () -> ByteArray)
Responds to a client with a raw bytes response, using specified provider to build a byte array
suspend fun ApplicationCall.respondBytes(bytes: ByteArray, contentType: ContentType? = null, status: HttpStatusCode? = null, configure: OutgoingContent.() -> Unit = {})
Responds to a client with a raw bytes response, using specified bytes
respondBytesWriter
Link copied to clipboard
suspend fun ApplicationCall.respondBytesWriter(contentType: ContentType? = null, status: HttpStatusCode? = null, producer: suspend ByteWriteChannel.() -> Unit)
Respond with binary content producer.
respondFile
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
respondOutputStream
Link copied to clipboard
suspend fun ApplicationCall.respondOutputStream(contentType: ContentType? = null, status: HttpStatusCode? = null, producer: suspend OutputStream.() -> Unit)
Respond with binary content producer.
respondRedirect
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: URLBuilder.() -> Unit)
Responds to a client with a 301 Moved Permanently or 302 Found redirect.
respondText
Link copied to clipboard
suspend fun ApplicationCall.respondText(text: String, contentType: ContentType? = null, status: HttpStatusCode? = null, configure: OutgoingContent.() -> Unit = {})
Responds to a client with a plain text response, using specified text
suspend fun ApplicationCall.respondText(contentType: ContentType? = null, status: HttpStatusCode? = null, provider: suspend () -> String)
Responds to a client with a plain text response, using specified provider to build a text
respondTextWriter
Link copied to clipboard
suspend fun ApplicationCall.respondTextWriter(contentType: ContentType? = null, status: HttpStatusCode? = null, writer: suspend Writer.() -> Unit)
Respond with text content writer.
sessionId
Link copied to clipboard
val ApplicationCall.sessionId: String?
Returns a sessionId for for a single session identified by ID.
inline fun <SessionType : Any> ApplicationCall.sessionId(): String?
Returns the corresponding session ID for the type SessionType or null if no session provided.
sessions
Link copied to clipboard
val ApplicationCall.sessions: CurrentSession
Get current session or fail if no session feature installed
suitableCharset
Link copied to clipboard
fun ApplicationCall.suitableCharset(defaultCharset: Charset = Charsets.UTF_8): Charset
Detect suitable charset for an application call by Accept header or fallback to defaultCharset
url
Link copied to clipboard
inline fun ApplicationCall.url(block: URLBuilder.() -> 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
withETag
Link copied to clipboard
suspend fun ApplicationCall.withETag(etag: String, putHeader: Boolean = true, block: suspend () -> Unit)
Checks current etag value and pass it through conditions supplied by the remote client.