接口 Rendering
public interface Rendering
Public API for HTML rendering. Supported as a return value in Spring WebFlux controllers. Comparable to the use ofModelAndView
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.- 从以下版本开始:
- 5.0
- 作者:
- Rossen Stoyanchev
嵌套类概要
嵌套类 修饰符和类型 接口 说明 static interface
Rendering.Builder<B extends Rendering.Builder<B>>
Defines a builder forRendering
.static interface
Rendering.RedirectBuilder
ExtendsRendering.Builder
with extra options for redirect scenarios.
方法概要
所有方法 静态方法 实例方法 抽象方法 修饰符和类型 方法 说明 HttpHeaders
headers()
Return headers to add to the response.Map<String,Object>
modelAttributes()
Return attributes to add to the model.static Rendering.RedirectBuilder
redirectTo(String url)
Create a new builder for a redirect through aRedirectView
.HttpStatus
status()
Return the HTTP status to set the response to.Object
view()
static Rendering.Builder<?>
view(String name)
Create a new builder for response rendering based on the given view name.
方法详细资料
modelAttributes
Map<String,Object> modelAttributes()
Return attributes to add to the model.
status
@Nullable HttpStatus status()
Return the HTTP status to set the response to.
headers
HttpHeaders headers()
Return headers to add to the response.
view
static Rendering.Builder<?> view(String name)
Create a new builder for response rendering based on the given view name.- 参数:
name
- the view name to be resolved to aView
- 返回:
- the builder
redirectTo
static Rendering.RedirectBuilder redirectTo(String url)
Create a new builder for a redirect through aRedirectView
.- 参数:
url
- the redirect URL- 返回:
- the builder