spring-framework / org.springframework.web.reactive.function.server

Package org.springframework.web.reactive.function.server

Types

RouterFunctionDsl

open class RouterFunctionDsl : () -> RouterFunction<ServerResponse>

Provide a RouterFunction Kotlin DSL in order to be able to write idiomatic Kotlin code.

Functions

body

fun <T : Any> BodyBuilder.body(publisher: Publisher<T>): Mono<ServerResponse>

Extension for ServerResponse.BodyBuilder.body providing a body(Publisher<T>) variant. This extension is not subject to type erasure and retains actual generic type arguments.

bodyToFlux

fun <T : Any> ServerRequest.bodyToFlux(): Flux<T>

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

bodyToMono

fun <T : Any> ServerRequest.bodyToMono(): Mono<T>

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

bodyToServerSentEvents

fun <T : Any> BodyBuilder.bodyToServerSentEvents(publisher: Publisher<T>): Mono<ServerResponse>

Extension for ServerResponse.BodyBuilder.body providing a bodyToServerSentEvents(Publisher<T>) variant. This extension is not subject to type erasure and retains actual generic type arguments.

html

fun BodyBuilder.html(): BodyBuilder

Shortcut for setting MediaType.TEXT_HTML Content-Type header.

json

fun BodyBuilder.json(): BodyBuilder

Shortcut for setting MediaType.APPLICATION_JSON_UTF8 Content-Type header.

router

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

Allow to create easily a RouterFunction<ServerResponse> from a Kotlin router DSL based on the same building blocks as the Java one (RouterFunction, RequestPredicate, HandlerFunction).

xml

fun BodyBuilder.xml(): BodyBuilder

Shortcut for setting MediaType.APPLICATION_XML Content-Type header.