Class ThymeleafReactiveView
- Object
-
- org.springframework.web.reactive.result.view.AbstractView
-
- org.thymeleaf.spring5.view.reactive.ThymeleafReactiveView
-
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.context.ApplicationContextAware,org.springframework.web.reactive.result.view.View
public class ThymeleafReactiveView extends org.springframework.web.reactive.result.view.AbstractView implements org.springframework.beans.factory.BeanNameAwareBase implementation of the Spring WebFlux
Viewinterface.Views represent a template being executed, after being resolved (and instantiated) by a
ViewResolver.This is the default view implementation resolved by
ThymeleafReactiveViewResolver.This view needs a
ISpringWebFluxTemplateEnginefor execution, and it will call itsISpringWebFluxTemplateEngine.processStream(String, Set, IContext, DataBufferFactory, MediaType, Charset, int)method to create the reactive data streams to be used for processing the template. See the documentation of this class to know more about the different operation modes available.- Since:
- 3.0.3
- Author:
- Daniel Fernández
- See Also:
ThymeleafReactiveViewResolver,ISpringWebFluxTemplateEngine,ReactiveDataDriverContextVariable,IReactiveDataDriverContextVariable
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_RESPONSE_CHUNK_SIZE_BYTESBy default, no max response chunk size is set.protected static org.slf4j.Loggerloggerstatic StringREACTIVE_MODEL_ADDITIONS_EXECUTION_ATTRIBUTE_PREFIXThis prefix should be used in order to allow dialects to provide reactive stream objects that should be resolved (in an unblocked manner) just before the execution of the view.
-
Constructor Summary
Constructors Constructor Description ThymeleafReactiveView()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddStaticVariable(String name, Object value)StringgetBeanName()protected LocalegetLocale()StringgetMarkupSelector()intgetResponseMaxChunkSizeBytes()Map<String,Object>getStaticVariables()protected ISpringWebFluxTemplateEnginegetTemplateEngine()StringgetTemplateName()reactor.core.publisher.Mono<Void>render(Map<String,?> model, org.springframework.http.MediaType contentType, org.springframework.web.server.ServerWebExchange exchange)protected reactor.core.publisher.Mono<Void>renderFragmentInternal(Set<String> markupSelectorsToRender, Map<String,Object> renderAttributes, org.springframework.http.MediaType contentType, org.springframework.web.server.ServerWebExchange exchange)protected reactor.core.publisher.Mono<Void>renderInternal(Map<String,Object> renderAttributes, org.springframework.http.MediaType contentType, org.springframework.web.server.ServerWebExchange exchange)voidsetBeanName(String beanName)voidsetDefaultCharset(Charset defaultCharset)protected voidsetLocale(Locale locale)voidsetMarkupSelector(String markupSelector)voidsetResponseMaxChunkSizeBytes(int responseMaxBufferSizeBytes)voidsetStaticVariables(Map<String,?> variables)voidsetSupportedMediaTypes(List<org.springframework.http.MediaType> supportedMediaTypes)protected voidsetTemplateEngine(ISpringWebFluxTemplateEngine templateEngine)voidsetTemplateName(String templateName)-
Methods inherited from class org.springframework.web.reactive.result.view.AbstractView
createRequestContext, getApplicationContext, getDefaultCharset, getModelAttributes, getRequestContextAttribute, getRequestDataValueProcessor, getSupportedMediaTypes, obtainApplicationContext, resolveAsyncAttributes, setApplicationContext, setRequestContextAttribute, toString
-
-
-
-
Field Detail
-
logger
protected static final org.slf4j.Logger logger
-
DEFAULT_RESPONSE_CHUNK_SIZE_BYTES
public static final int DEFAULT_RESPONSE_CHUNK_SIZE_BYTES
By default, no max response chunk size is set. Value =Integer.MAX_VALUE- See Also:
- Constant Field Values
-
REACTIVE_MODEL_ADDITIONS_EXECUTION_ATTRIBUTE_PREFIX
public static final String REACTIVE_MODEL_ADDITIONS_EXECUTION_ATTRIBUTE_PREFIX
This prefix should be used in order to allow dialects to provide reactive stream objects that should be resolved (in an unblocked manner) just before the execution of the view. The idea is to allow these streams to be included in the standard reactive Spring view model resolution mechanisms so that Thymeleaf does not have to block during the execution of the view in order to obtain the value. The result will be as if reactive stream objects had been added by the controller methods.
The name of the attributes being added to the Model will be the name of the execution attribute minus the prefix. So
ThymeleafReactiveModelAdditions:somedatawill result in a Model attribute calledsomedata.Values of these execution attributes are allowed to be:
Publisher<?>(includingFlux<?>andMono<?>).Supplier<? extends Publisher<?>>: The supplier will be called atViewrendering time and the result will be added to the Model.Function<ServerWebExchange,? extends Publisher<?>>: The function will be called atViewrendering time and the result will be added to the Model.
Value:
"ThymeleafReactiveModelAdditions:"- Since:
- 3.0.10
- See Also:
- Constant Field Values
-
-
Method Detail
-
getMarkupSelector
public String getMarkupSelector()
-
setMarkupSelector
public void setMarkupSelector(String markupSelector)
-
setDefaultCharset
public void setDefaultCharset(Charset defaultCharset)
- Overrides:
setDefaultCharsetin classorg.springframework.web.reactive.result.view.AbstractView
-
setSupportedMediaTypes
public void setSupportedMediaTypes(List<org.springframework.http.MediaType> supportedMediaTypes)
- Overrides:
setSupportedMediaTypesin classorg.springframework.web.reactive.result.view.AbstractView
-
getBeanName
public String getBeanName()
-
setBeanName
public void setBeanName(String beanName)
- Specified by:
setBeanNamein interfaceorg.springframework.beans.factory.BeanNameAware
-
getTemplateName
public String getTemplateName()
-
setTemplateName
public void setTemplateName(String templateName)
-
getLocale
protected Locale getLocale()
-
setLocale
protected void setLocale(Locale locale)
-
getResponseMaxChunkSizeBytes
public int getResponseMaxChunkSizeBytes()
-
setResponseMaxChunkSizeBytes
public void setResponseMaxChunkSizeBytes(int responseMaxBufferSizeBytes)
-
getTemplateEngine
protected ISpringWebFluxTemplateEngine getTemplateEngine()
-
setTemplateEngine
protected void setTemplateEngine(ISpringWebFluxTemplateEngine templateEngine)
-
render
public reactor.core.publisher.Mono<Void> render(Map<String,?> model, org.springframework.http.MediaType contentType, org.springframework.web.server.ServerWebExchange exchange)
- Specified by:
renderin interfaceorg.springframework.web.reactive.result.view.View- Overrides:
renderin classorg.springframework.web.reactive.result.view.AbstractView
-
renderInternal
protected reactor.core.publisher.Mono<Void> renderInternal(Map<String,Object> renderAttributes, org.springframework.http.MediaType contentType, org.springframework.web.server.ServerWebExchange exchange)
- Specified by:
renderInternalin classorg.springframework.web.reactive.result.view.AbstractView
-
-