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

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

Types

CoRouterFunctionDsl

class CoRouterFunctionDsl

Provide a WebFlux.fn RouterFunction Coroutines Kotlin DSL created by coRouter { } in order to be able to write idiomatic Kotlin code.

RouterFunctionDsl

class RouterFunctionDsl

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

Functions

awaitBody

suspend fun <T : Any> ServerRequest.awaitBody(): T

Non-nullable Coroutines variant of ServerRequest.bodyToMono.

awaitBodyOrNull

suspend fun <T : Any> ServerRequest.awaitBodyOrNull(): T?

Nullable Coroutines variant of ServerRequest.bodyToMono.

awaitFormData

suspend fun ServerRequest.awaitFormData(): MultiValueMap<String, String>

Coroutines variant of ServerRequest.formData.

awaitMultipartData

suspend fun ServerRequest.awaitMultipartData(): MultiValueMap<String, Part>

Coroutines variant of ServerRequest.multipartData.

awaitPrincipal

suspend fun ServerRequest.awaitPrincipal(): Principal?

Coroutines variant of ServerRequest.principal.

awaitSession

suspend fun ServerRequest.awaitSession(): WebSession

Coroutines variant of ServerRequest.session.

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.

bodyAndAwait

suspend fun BodyBuilder.bodyAndAwait(body: Any): ServerResponse

Coroutines variant of ServerResponse.BodyBuilder.body with an Any parameter.

suspend fun <T : Any> BodyBuilder.bodyAndAwait(flow: Flow<T>): ServerResponse

Coroutines variant of ServerResponse.BodyBuilder.body with Any and ParameterizedTypeReference parameters providing a bodyAndAwait(Flow<T>) variant. This extension is not subject to type erasure and retains actual generic type arguments.

bodyToFlow

fun <T : Any> ServerRequest.bodyToFlow(): Flow<T>

Coroutines kotlinx.coroutines.flow.Flow based variant of ServerRequest.bodyToFlux.

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.

bodyWithType

fun <T : Any> BodyBuilder.bodyWithType(producer: Any): Mono<ServerResponse>

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

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

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

buildAndAwait

suspend fun Builder.buildAndAwait(): RenderingResponse

Coroutines variant of RenderingResponse.Builder.build.

suspend fun HeadersBuilder<out HeadersBuilder<*>>.buildAndAwait(): ServerResponse

Coroutines variant of ServerResponse.HeadersBuilder.build.

coRouter

fun coRouter(routes: CoRouterFunctionDsl.() -> Unit): RouterFunction<ServerResponse>

Allow to create easily a WebFlux.fn RouterFunction with a Coroutines router Kotlin DSL.

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 Content-Type header.

plus

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

Equivalent to RouterFunction.and.

renderAndAwait

suspend fun BodyBuilder.renderAndAwait(name: String, vararg modelAttributes: String): ServerResponse
suspend fun BodyBuilder.renderAndAwait(name: String, model: Map<String, *>): ServerResponse

Coroutines variant of ServerResponse.BodyBuilder.render.

router

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

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

sse

fun BodyBuilder.sse(): BodyBuilder!

Shortcut for setting MediaType.TEXT_EVENT_STREAM Content-Type header.

xml

fun BodyBuilder.xml(): BodyBuilder!

Shortcut for setting MediaType.APPLICATION_XML Content-Type header.