Class HttpMessageWriterView
java.lang.Object
org.springframework.web.reactive.result.view.HttpMessageWriterView
- All Implemented Interfaces:
- View
View that writes model attribute(s) with an HttpMessageWriter.- Since:
- 5.0
- Author:
- Rossen Stoyanchev
- 
Field SummaryFields inherited from interface ViewBINDING_CONTEXT_ATTRIBUTE
- 
Constructor SummaryConstructorsConstructorDescriptionHttpMessageWriterView(Encoder<?> encoder) Constructor with anEncoder.HttpMessageWriterView(HttpMessageWriter<?> writer) Constructor with a fully initializedHttpMessageWriter.
- 
Method SummaryModifier and TypeMethodDescriptionReturn the configured message writer.Return the configured model keys.Return the list of media types this View supports, or an empty list.reactor.core.publisher.Mono<Void> Render the view based on the givenHandlerResult.voidsetModelKeys(@Nullable Set<String> modelKeys) Set the attributes in the model that should be rendered by this view.Methods inherited from class Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ViewisRedirectView
- 
Constructor Details- 
HttpMessageWriterViewConstructor with anEncoder.
- 
HttpMessageWriterViewConstructor with a fully initializedHttpMessageWriter.
 
- 
- 
Method Details- 
getMessageWriterReturn the configured message writer.
- 
getSupportedMediaTypesReturn the list of media types this View supports, or an empty list.The implementation of this method for HttpMessageWriterViewdelegates toHttpMessageWriter.getWritableMediaTypes().- Specified by:
- getSupportedMediaTypesin interface- View
 
- 
setModelKeysSet the attributes in the model that should be rendered by this view. When set, all other model attributes will be ignored. The matching attributes are further narrowed withHttpMessageWriter.canWrite(ResolvableType, MediaType). The matching attributes are processed as follows:- 0: nothing is written to the response body.
- 1: the matching attribute is passed to the writer.
- 2..N: if the writer supports Map, write all matches; otherwise raise anIllegalStateException.
 
- 
getModelKeys
- 
renderpublic reactor.core.publisher.Mono<Void> render(@Nullable Map<String, ?> model, @Nullable MediaType contentType, ServerWebExchange exchange) Description copied from interface:ViewRender the view based on the givenHandlerResult. Implementations can access and use the model or only a specific attribute in it.- Specified by:
- renderin interface- View
- Parameters:
- model- a Map with name Strings as keys and corresponding model objects as values (Map can also be- nullin case of empty model)
- contentType- the content type selected to render with which should match one of the- supported media types.
- exchange- the current exchange
- Returns:
- Monoto represent when and if rendering succeeds
 
 
-