public interface IThrottledTemplateProcessor
Interface defining operations that can regulate the pace at which the template engine will process a
template (a.k.a. engine throttling). Objects implementing this interface are returned by
the processThrottled(...) methods at ITemplateEngine
.
When the processing of a template is throttled the client classes can tell the engine how much output
they are prepared to handle by calling process(int)
. As a response to this,
the engine will process only the part of the template enough to write so many chars as specified to the
Writer
object that was specified at the processThrottled(...) call.
Once the desired amount of chars has been written to the Writer
, the engine stops where it is with minimum
or no pending output caching, and returns control of the process(int)
call, so that the client can
process output and prepare for a subsequent call. Note that this whole process is
single-threaded.
Among other scenarios, this should allow Thymeleaf to be efficiently integrated as a back-pressure-driven cold observable in a reactive architecture.
ITemplateEngine.processThrottled(String, IContext, Writer)
,
ITemplateEngine.processThrottled(String, Set, IContext, Writer)
,
ITemplateEngine.processThrottled(TemplateSpec, IContext, Writer)
Modifier and Type | Method and Description |
---|---|
boolean |
isFinished()
Checks whether the processing of the template has already finished.
|
void |
process(int outputLimitInChars)
Process the template until the specified amount of chars has been written to output, then return control.
|
void |
processAll()
Process the whole template (all parts remaining), with no limit in the amount of chars written to output.
|
boolean isFinished()
Checks whether the processing of the template has already finished.
void processAll()
Process the whole template (all parts remaining), with no limit in the amount of chars written to output.
void process(int outputLimitInChars)
Process the template until the specified amount of chars has been written to output, then return control.
outputLimitInChars
- the amount of chars that the engine is allowed to output. A number < 0 or
Integer.MAX_VALUE
will mean "no limit".Copyright © 2016 The THYMELEAF team. All rights reserved.