Package org.mockserver.templates.engine
Class DelayTemplateResolver
java.lang.Object
org.mockserver.templates.engine.DelayTemplateResolver
Resolves an opt-in template
Delay into a concrete millisecond Delay by rendering its
template against the incoming request (the same request context exposed to response templates).
Resolution is deliberately fail-safe: any rendering failure, an unsupported template type, or a
rendered value that does not parse to a non-negative whole number of milliseconds falls back to the
delay's static value/timeUnit pair (zero by default) rather than failing the response.
A Delay without a template is returned unchanged, so static and statistical delays behave
byte-for-byte as before.
- Author:
- jamesdbloom
-
Constructor Summary
ConstructorsConstructorDescriptionDelayTemplateResolver(MockServerLogger mockServerLogger, Configuration configuration) -
Method Summary
Modifier and TypeMethodDescriptionresolve(Delay delay, HttpRequest request) Returns a delay whose duration is fixed for the supplied request.
-
Constructor Details
-
DelayTemplateResolver
-
-
Method Details
-
resolve
Returns a delay whose duration is fixed for the supplied request. Whendelaycarries a template it is rendered and parsed into a millisecond delay; otherwise (or on any failure) the originaldelayis returned unchanged.
-