接口 View
- 所有已知实现类:
AbstractUrlBasedView
,AbstractView
,FreeMarkerView
,HttpMessageWriterView
,RedirectView
,ScriptTemplateView
public interface View
Contract to renderHandlerResult
to the HTTP response.In contrast to an
Encoder
which is a singleton and encodes any object of a given type, aView
is typically selected by name and resolved using aViewResolver
which may for example match it to an HTML template. Furthermore aView
may render based on multiple attributes contained in the model.A
View
can also choose to select an attribute from the model use any existingEncoder
to render alternate media types.- 从以下版本开始:
- 5.0
- 作者:
- Rossen Stoyanchev
字段概要
字段 修饰符和类型 字段 说明 static String
BINDING_CONTEXT_ATTRIBUTE
The name of the exchange attribute that contains theBindingContext
for the request which can be used to createBindingResult
instances for objects in to the model.
方法概要
所有方法 实例方法 抽象方法 默认方法 修饰符和类型 方法 说明 default List<MediaType>
getSupportedMediaTypes()
Return the list of media types this View supports, or an empty list.default boolean
isRedirectView()
Whether this View does rendering by performing a redirect.reactor.core.publisher.Mono<Void>
render(Map<String,?> model, MediaType contentType, ServerWebExchange exchange)
Render the view based on the givenHandlerResult
.
字段详细资料
BINDING_CONTEXT_ATTRIBUTE
static final String BINDING_CONTEXT_ATTRIBUTE
The name of the exchange attribute that contains theBindingContext
for the request which can be used to createBindingResult
instances for objects in to the model.Note: This attribute is not required and may not be present.
- 从以下版本开始:
- 5.1.8
方法详细资料
getSupportedMediaTypes
default List<MediaType> getSupportedMediaTypes()
Return the list of media types this View supports, or an empty list.
isRedirectView
default boolean isRedirectView()
Whether this View does rendering by performing a redirect.
render
reactor.core.publisher.Mono<Void> render(@Nullable Map<String,?> model, @Nullable MediaType contentType, ServerWebExchange exchange)
Render the view based on the givenHandlerResult
. Implementations can access and use the model or only a specific attribute in it.- 参数:
model
- a Map with name Strings as keys and corresponding model objects as values (Map can also benull
in case of empty model)contentType
- the content type selected to render with which should match one of thesupported media types
.exchange
- the current exchange- 返回:
Mono
to represent when and if rendering succeeds