spring-framework / org.springframework.web.servlet.function

Package org.springframework.web.servlet.function

Types

RouterFunctionDsl

class RouterFunctionDsl

Provide a WebMvc.fn RouterFunction Reactive Kotlin DSL created by router { } in order to be able to write idiomatic Kotlin code.

Functions

attributeOrNull

fun ServerRequest.attributeOrNull(name: String): Any?

Nullable variant of ServerRequest.attribute

body

fun <T : Any> ServerRequest.body(): T

Extension for ServerRequest.body providing a body<Foo>() variant leveraging Kotlin reified type parameters. This extension is not subject to type erasure and retains actual generic type arguments.

bodyWithType

fun <T : Any> BodyBuilder.bodyWithType(body: T): ServerResponse!

Extension for ServerResponse.BodyBuilder.body providing a variant leveraging Kotlin reified type parameters.

contentLengthOrNull

fun Headers.contentLengthOrNull(): Long?

Nullable variant of ServerRequest.Headers.contentLength

contentTypeOrNull

fun Headers.contentTypeOrNull(): MediaType?

Nullable variant of ServerRequest.Headers.contentType

paramOrNull

fun ServerRequest.paramOrNull(name: String): String?

Nullable variant of ServerRequest.param

plus

operator fun <T : ServerResponse> RouterFunction<T>.plus(other: RouterFunction<T>): RouterFunction<T!>!

Equivalent to RouterFunction.and.

principalOrNull

fun ServerRequest.principalOrNull(): Principal?

Nullable variant of ServerRequest.param

remoteAddressOrNull

fun ServerRequest.remoteAddressOrNull(): InetSocketAddress?

Nullable variant of ServerRequest.remoteAddress

router

fun router(routes: RouterFunctionDsl.() -> Unit): RouterFunction<ServerResponse>

Allow to create easily a WebMvc.fn RouterFunction with a Reactive router Kotlin DSL.