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

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

Types

CoRouterFunctionDsl

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

class CoRouterFunctionDsl

RouterFunctionDsl

Provide a WebFlux.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?

awaitBody

Non-nullable Coroutines variant of ServerRequest.bodyToMono.

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

KClass non-nullable Coroutines variant of ServerRequest.bodyToMono. Please consider awaitBody<Foo> variant if possible.

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

awaitBodyOrNull

Nullable Coroutines variant of ServerRequest.bodyToMono.

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

KClass nullable Coroutines variant of ServerRequest.bodyToMono. Please consider awaitBodyOrNull<Foo> variant if possible.

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

awaitFormData

Coroutines variant of ServerRequest.formData.

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

awaitMultipartData

Coroutines variant of ServerRequest.multipartData.

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

awaitPrincipal

Coroutines variant of ServerRequest.principal.

suspend fun ServerRequest.awaitPrincipal(): Principal?

awaitSession

Coroutines variant of ServerRequest.session.

suspend fun ServerRequest.awaitSession(): WebSession

body

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.

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

Extension for ServerResponse.BodyBuilder.body providing a body<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.body(producer: Any): Mono<ServerResponse>

bodyAndAwait

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.

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

bodyToFlow

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

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

KClass coroutines kotlinx.coroutines.flow.Flow based variant of ServerRequest.bodyToFlux. Please consider bodyToFlow<Foo> variant if possible.

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

bodyToFlux

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.

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

bodyToMono

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.

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

bodyToServerSentEvents

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.

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

bodyValueAndAwait

Coroutines variant of ServerResponse.BodyBuilder.bodyValue.

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

buildAndAwait

Coroutines variant of RenderingResponse.Builder.build.

suspend fun Builder.buildAndAwait(): RenderingResponse

Coroutines variant of ServerResponse.HeadersBuilder.build.

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

contentLengthOrNull

Nullable variant of ServerRequest.Headers.contentLength

fun Headers.contentLengthOrNull(): Long?

contentTypeOrNull

Nullable variant of ServerRequest.Headers.contentType

fun Headers.contentTypeOrNull(): MediaType?

coRouter

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

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

html

Shortcut for setting MediaType.TEXT_HTML Content-Type header.

fun BodyBuilder.html(): BodyBuilder!

json

Shortcut for setting MediaType.APPLICATION_JSON Content-Type header.

fun BodyBuilder.json(): BodyBuilder!

plus

Equivalent to RouterFunction.and.

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

queryParamOrNull

Nullable variant of ServerRequest.queryParam

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

remoteAddressOrNull

Nullable variant of ServerRequest.remoteAddress

fun ServerRequest.remoteAddressOrNull(): InetSocketAddress?

renderAndAwait

Coroutines variant of ServerResponse.BodyBuilder.render.

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

router

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

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

sse

Shortcut for setting MediaType.TEXT_EVENT_STREAM Content-Type header.

fun BodyBuilder.sse(): BodyBuilder!

xml

Shortcut for setting MediaType.APPLICATION_XML Content-Type header.

fun BodyBuilder.xml(): BodyBuilder!