Interface Rendering
public 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.
- Since:
- 5.0
- Author:
- Rossen Stoyanchev
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Rendering.Builder<B extends Rendering.Builder<B>>
Defines a builder forRendering
.static interface
ExtendsRendering.Builder
with extra options for redirect scenarios. -
Method Summary
Modifier and TypeMethodDescriptionheaders()
Return headers to add to the response.Return attributes to add to the model.static Rendering.RedirectBuilder
redirectTo
(String url) Create a new builder for a redirect through aRedirectView
.status()
Return the HTTP status to set the response to.view()
static Rendering.Builder<?>
Create a new builder for response rendering based on the given view name.
-
Method Details
-
view
-
modelAttributes
Return attributes to add to the model. -
status
@Nullable HttpStatusCode status()Return the HTTP status to set the response to. -
headers
HttpHeaders headers()Return headers to add to the response. -
view
Create a new builder for response rendering based on the given view name.- Parameters:
name
- the view name to be resolved to aView
- Returns:
- the builder
-
redirectTo
Create a new builder for a redirect through aRedirectView
.- Parameters:
url
- the redirect URL- Returns:
- the builder
-