public interface ISpringWebFluxTemplateEngine extends ISpringTemplateEngine
Sub-interface of ISpringTemplateEngine
meant for Spring WebFlux applications, adding
methods specifically needed for the execution of templates in a reactive-friendly way.
Template engines implementing this interface offer three possible processing modes (note Reactive Streams terminology is used in the explanation):
Publisher
driving the template engine execution): In this case Thymeleaf will be executed unthrottled,
computing the whole template in memory and sending all output to the output channels in a single
Subscriber.onNext(Object)
call, immediately followed by Subscriber.onComplete()
.
Publisher
driving engine execution). All context variables are
expected to be fully resolved before engine execution -except those implementing Thymeleaf's
ILazyContextVariable
interface, including its reactive implementation
ReactiveLazyContextVariable
- and the Thymeleaf
engine will execute in throttled mode, performing a full-stop each time the output buffer reaches
the specified size, sending it to the output channels with Subscriber.onNext(Object)
and then
waiting until these output channels make the engine resume its work with a new
Subscription.request(long)
back-pressure call.
Publisher
data stream wrapped inside an implementation
of the IReactiveDataDriverContextVariable
interface. In
this case, Thymeleaf will act as a Subscriber
of this data stream and a
Publisher
of output buffers (the combination of which turns Thymeleaf into a Processor
in Reactive Streams terminology). Thymeleaf will execute as a response to
Subscriber.onNext(Object)
events triggered by this data-driver
Publisher
. Thymeleaf will expect to find a th:each iteration on the data-driven variable
inside the processed template, and will be executed in throttled mode for the published elements, sending
the resulting output buffers to the output channels via Subscriber.onNext(Object)
and stopping
until the data-driver Publisher
produces new data (normally after being requested to do
so via back-pressure. When execution is data-driven, a limit in size can be optionally specified for
the output buffers which will make Thymeleaf never send to the output channels a buffer bigger than that.
The SpringWebFluxTemplateEngine
implementation of this interface (or a subclass) should be used
in almost every case, but this interface improves testability of these artifacts.
SpringWebFluxTemplateEngine
Modifier and Type | Method and Description |
---|---|
org.reactivestreams.Publisher<org.springframework.core.io.buffer.DataBuffer> |
processStream(String template,
Set<String> markupSelectors,
org.thymeleaf.context.IContext context,
org.springframework.core.io.buffer.DataBufferFactory bufferFactory,
org.springframework.http.MediaType mediaType,
Charset charset) |
org.reactivestreams.Publisher<org.springframework.core.io.buffer.DataBuffer> |
processStream(String template,
Set<String> markupSelectors,
org.thymeleaf.context.IContext context,
org.springframework.core.io.buffer.DataBufferFactory bufferFactory,
org.springframework.http.MediaType mediaType,
Charset charset,
int responseMaxChunkSizeBytes) |
setTemplateEngineMessageSource
org.reactivestreams.Publisher<org.springframework.core.io.buffer.DataBuffer> processStream(String template, Set<String> markupSelectors, org.thymeleaf.context.IContext context, org.springframework.core.io.buffer.DataBufferFactory bufferFactory, org.springframework.http.MediaType mediaType, Charset charset)
org.reactivestreams.Publisher<org.springframework.core.io.buffer.DataBuffer> processStream(String template, Set<String> markupSelectors, org.thymeleaf.context.IContext context, org.springframework.core.io.buffer.DataBufferFactory bufferFactory, org.springframework.http.MediaType mediaType, Charset charset, int responseMaxChunkSizeBytes)
Copyright © 2017 The THYMELEAF team. All rights reserved.