Package io.ktor.server.request

Types

Link copied to clipboard
open class ApplicationReceivePipeline(developmentMode: Boolean)

A pipeline for processing incoming content. When executed, this pipeline starts with an instance of ByteReadChannel.

Link copied to clipboard
interface ApplicationRequest

A client's request. To learn how to handle incoming requests, see Handling requests.

Link copied to clipboard

Thrown when content cannot be transformed to the desired type.

Link copied to clipboard
class RequestAlreadyConsumedException : IllegalStateException

Thrown when a request body has already been received. Usually it is caused by double ApplicationCall.receive invocation.

Link copied to clipboard
open class RequestCookies(request: ApplicationRequest)

Server request's cookies.

Functions

Link copied to clipboard
fun ApplicationRequest.accept(): String?

Get a request's Accept header value.

Link copied to clipboard
fun ApplicationRequest.acceptCharset(): String?

Gets a request's Accept-Charset header value.

Link copied to clipboard
fun ApplicationRequest.acceptCharsetItems(): List<<ERROR CLASS>>

Gets the Accept-Charset header charsets sorted according to their qualities.

Link copied to clipboard
fun ApplicationRequest.acceptEncoding(): String?

Gets a request's Accept-Encoding header value.

Link copied to clipboard
fun ApplicationRequest.acceptEncodingItems(): List<<ERROR CLASS>>

Gets the Accept-Encoding header encoding types sorted according to their qualities.

Link copied to clipboard
fun ApplicationRequest.acceptItems(): List<<ERROR CLASS>>

Gets the Accept header content types sorted according to their qualities.

Link copied to clipboard
fun ApplicationRequest.acceptLanguage(): String?

Gets a request's Accept-Language header value.

Link copied to clipboard
fun ApplicationRequest.acceptLanguageItems(): List<<ERROR CLASS>>

Gets the Accept-Language header languages sorted according to their qualities.

Link copied to clipboard
fun ApplicationRequest.authorization(): String?

Get a request's Authorization header value.

Link copied to clipboard
fun ApplicationRequest.cacheControl(): String?

Gets a request's Cache-Control header value.

Link copied to clipboard
fun ApplicationRequest.contentCharset(): <ERROR CLASS>?

Gets a request's charset.

Link copied to clipboard
fun ApplicationRequest.contentLength(): Long?

Gets a request's Content-Length header value.

Link copied to clipboard
fun ApplicationRequest.contentType(): <ERROR CLASS>

Gets a request's content type or returns ContentType.Any.

Link copied to clipboard
fun ApplicationRequest.document(): String

A document name is a substring after the last slash but before a query string.

Link copied to clipboard
fun ApplicationRequest.encodeParameters(parameters: <ERROR CLASS>): <ERROR CLASS>

Internal helper function to encode raw parameters. Should not be used directly.

Link copied to clipboard
fun ApplicationRequest.header(name: String): String?

Gets the first value of a name header or returns null if missing.

Link copied to clipboard
fun ApplicationRequest.host(): String

Gets a request's host value without a port.

Link copied to clipboard
fun ApplicationRequest.isChunked(): Boolean

Checks whether a request's body is chunk-encoded.

Link copied to clipboard
fun ApplicationRequest.isMultipart(): Boolean

Checks whether a request body is multipart-encoded.

Link copied to clipboard
fun ApplicationRequest.location(): String?

Get a request's Location header value.

Link copied to clipboard
fun ApplicationRequest.path(): String

Get a request's URL path without a query string.

Link copied to clipboard
fun ApplicationRequest.port(): Int

Gets a request's port extracted from the Host header value.

Link copied to clipboard
fun ApplicationRequest.queryString(): String

Gets a request's query string or returns an empty string if missing.

Link copied to clipboard
fun ApplicationRequest.ranges(): <ERROR CLASS>?

Gets ranges parsed from a request's Range header value.

Link copied to clipboard
inline suspend fun <T : Any> ApplicationCall.receive(): T
suspend fun <T : Any> ApplicationCall.receive(typeInfo: <ERROR CLASS>): T
suspend fun <T : Any> ApplicationCall.receive(type: KClass<T>): 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
fun ApplicationRequest.userAgent(): String?

Gets a request's User-Agent header value.

Properties

Link copied to clipboard
val ApplicationRequest.httpMethod: <ERROR CLASS>

Gets a request HTTP method possibly overridden using the X-Http-Method-Override header.

Link copied to clipboard
val ApplicationRequest.httpVersion: String

Gets a request's HTTP version.

Link copied to clipboard
val ApplicationRequest.uri: String

Gets a request's URI, including a query string.