public interface ISpringWebReactiveTemplateEngine extends ISpringTemplateEngine
ISpringTemplateEngine meant for Spring Web Reactive 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):
Publisherdriving 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
Publisherdriving engine execution). All context variables are expected to be fully resolved before engine execution -except those implementing Thymeleaf's
ILazyContextVariableinterface, 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
Publisherdata stream wrapped inside an implementation of the
IReactiveDataDriverContextVariableinterface. In this case, Thymeleaf will act as a
Subscriberof this data stream and a
Publisherof output buffers (the combination of which turns Thymeleaf into a
Processorin 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
Publisherproduces 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.
SpringWebReactiveTemplateEngine implementation of this interface (or a subclass) should be used
in almost every case, but this interface improves testability of these artifacts.
|Modifier and Type||Method and Description|
Copyright © 2017 The THYMELEAF team. All rights reserved.