Class DelayTemplateResolver

java.lang.Object
org.mockserver.templates.engine.DelayTemplateResolver

public class DelayTemplateResolver extends Object
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 Details

  • Method Details

    • resolve

      public Delay resolve(Delay delay, HttpRequest request)
      Returns a delay whose duration is fixed for the supplied request. When delay carries a template it is rendered and parsed into a millisecond delay; otherwise (or on any failure) the original delay is returned unchanged.