spring-framework / org.springframework.web.reactive.result.view / Rendering

Rendering

interface Rendering

Public API for HTML rendering. Supported as a return value in Spring WebFlux controllers. Comparable to the use of ModelAndView as a return value in Spring MVC controllers.

Controllers typically return a String view name and rely on the "implicit" model which can also be injected into the controller method. Or controllers may return model attribute(s) and rely on a default view name being selected based on the request path.

Rendering can be used to combine a view name with model attributes, set the HTTP status or headers, and for other more advanced options around redirect scenarios.

Author
Rossen Stoyanchev

Since
5.0

Functions

headers

abstract fun headers(): HttpHeaders

Return headers to add to the response.

modelAttributes

abstract fun modelAttributes(): MutableMap<String, Any>

Return attributes to add to the model.

redirectTo

open static fun redirectTo(url: String): RedirectBuilder

Create a new builder for a redirect through a RedirectView.

status

abstract fun status(): HttpStatus

Return the HTTP status to set the response to.

view

abstract fun view(): Any

Return the selected String view name or View object.

open static fun view(name: String): Builder

Create a new builder for response rendering based on the given view name.