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

Package org.springframework.web.servlet.function

Types

RouterFunctionDsl

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

class RouterFunctionDsl

Functions

attributeOrNull

Nullable variant of ServerRequest.attribute

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

body

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.

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

bodyWithType

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

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

contentLengthOrNull

Nullable variant of ServerRequest.Headers.contentLength

fun Headers.contentLengthOrNull(): Long?

contentTypeOrNull

Nullable variant of ServerRequest.Headers.contentType

fun Headers.contentTypeOrNull(): MediaType?

paramOrNull

Nullable variant of ServerRequest.param

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

plus

Equivalent to RouterFunction.and.

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

principalOrNull

Nullable variant of ServerRequest.param

fun ServerRequest.principalOrNull(): Principal?

remoteAddressOrNull

Nullable variant of ServerRequest.remoteAddress

fun ServerRequest.remoteAddressOrNull(): InetSocketAddress?

router

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

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