Interface TemplateEngine

All Known Implementing Classes:
JavaScriptTemplateEngine, MustacheTemplateEngine, VelocityTemplateEngine

public interface TemplateEngine
Author:
jamesdbloom
  • Method Details

    • executeTemplate

      <T> T executeTemplate(String template, HttpRequest httpRequest, Class<? extends DTO<T>> dtoClass)
    • executeTemplate

      <T> T executeTemplate(String template, HttpRequest httpRequest, HttpResponse httpResponse, Class<? extends DTO<T>> dtoClass)
    • renderTemplate

      String renderTemplate(String template, HttpRequest httpRequest)
      Renders a template against the request and returns the raw rendered text, without attempting to deserialize it into an HttpResponse / HttpRequest. Used to template the contents of a FileBody so an externally stored response body can contain template placeholders. Supported by the text-based engines (Velocity, Mustache).
    • renderTemplate

      default String renderTemplate(String template, HttpRequest httpRequest, IterationContext iteration)
      Renders a template against the request with an optional per-iteration load-scenario variable injected under the key "iteration", returning the raw rendered text. Used only by the load-generation executor to vary a request step's fields per iteration (e.g. $iteration.index). When iteration is null this is identical to renderTemplate(String, HttpRequest). The default delegates to that method so engines that do not support the iteration variable (JavaScript via this text path) still render the request context unchanged.
      Parameters:
      template - the template text
      httpRequest - the request context
      iteration - the per-iteration variable, or null for no iteration context