<aside> <img src="attachment:a3a56fc3-c53c-47ff-aacc-d7c34f62abfd:table_of_content.png" alt="attachment:a3a56fc3-c53c-47ff-aacc-d7c34f62abfd:table_of_content.png" width="40px" />

TABLE OF CONTENT

</aside>

Package dev.tommasop1804.springutils.reactive.request
Since version 2.0.0
JVM class name ReactiveRequestUtilsKt

Functions


Headers

:ij-function: ServerRequest.header(String)

Since version 2.0.0
Returns :ij-kt-interface: List<String>
Parameters name: :ij-kt-class: String → the name of the header to retrieve

Retrieves the values of the specified header from the server request.

:ij-function: ServerRequest.headerOrThrow(String, KClass<*>, (() -> Throwable)~)

Since version 2.0.0
Returns :ij-kt-class: String
Parameters name: :ij-kt-class: String → the name of the header to retrieve
class: :ij-kt-interface: KClass<*> → the expected type class of the header, used for informational purposes when the exception is thrown
lazyException: ‣ () -> Throwable (default: { RequiredHeaderException(name, class) }) → a supplier function to create the exception to be thrown if the header is missing

Retrieves the value of a header by its name or throws an exception if it is missing.

This method attempts to fetch the specified query parameter from the request. If the header is not found, it throws a lazily created exception provided by the lazyException parameter.

:ij-function: ServerRequest.headerOrThrow(String, KClass<*>, String)

Since version 2.0.0
Returns :ij-kt-class: String
Parameters name: :ij-kt-class: String → the name of the header to retrieve
class: :ij-kt-interface: KClass<*> → the expected type class of the header, used for informational purposes when the exception is thrown
internalErrorCode: :ij-kt-class: String → an internal error code that adds context to the thrown exception
Exceptions RequiredHeaderException → if the header is not present in the request

Retrieves the value of a header by its name or throws an exception if it is missing.

This method attempts to fetch the specified header from the request. If the header is not found, it throws a RequiredHeaderException with the provided internal error code.

:ij-function: ServerRequest.headerOrDefault(String, () -> Any)

Since version 2.0.0
Returns :ij-kt-class: String
Parameters name: :ij-kt-class: String → the name of the header to retrieve
default: ‣ () -> Any → a supplier that provides a default value if the header is not found

Retrieves the header value associated with the given name or, if not present, returns a default value provided by the given supplier.

<aside> <img src="attachment:f407d415-108c-4b0e-a5a9-7c1df3b59a9c:plus.png" alt="attachment:f407d415-108c-4b0e-a5a9-7c1df3b59a9c:plus.png" width="40px" />

There are other functions that use ServerRequest as a receiver, and are specialized to return some headers:

Path variables

:ij-function: ServerRequest.pathVariableOrThrow(String, KClass<*>, (() -> Throwable)~)

Since version 2.0.0
Returns :ij-kt-class: String
Parameters name: :ij-kt-class: String → the name of the path variable to retrieve
class: :ij-kt-interface: KClass<*> → the expected type class of the path variable, used for informational purposes when the exception is thrown
lazyException: ‣ () -> Throwable (default: { [RequiredPathVariableException](<https://tommasop1804.notion.site/Exceptions-32e8b91677358085b9afdf3ff98936ea>)(name, class) }) → a supplier function to create the exception to be thrown if the path variable is missing

Retrieves the value of a path variable by its name or throws an exception if it is missing.

This method attempts to fetch the specified path variable from the request. If the parameter is not found, it throws a lazily created exception provided by the lazyException parameter.

:ij-function: ServerRequest.pathVariableOrThrow(String, KClass<*>, String)

Since version 2.0.0
Returns :ij-kt-class: String
Parameters name: :ij-kt-class: String → the name of the path variable to retrieve
class: :ij-kt-interface: KClass<*> → the expected type class of the path variable, used for informational purposes when the exception is thrown
internalErrorCode: :ij-kt-class: String → an internal error code that adds context to the thrown exception
Exceptions RequiredPathVariableException → if the path variable is not present in the request

Retrieves the value of a path variable by its name or throws an exception if it is missing.

This method attempts to fetch the specified path variable from the request. If the variable is not found, it throws a RequiredPathVariableException with the provided internal error code.

:ij-function: ServerRequest.pathVariableOrDefault(String, () -> Any)

| --- | --- |