Package org.mockserver.templates.engine
Interface TemplateEngine
- All Known Implementing Classes:
JavaScriptTemplateEngine,MustacheTemplateEngine,VelocityTemplateEngine
public interface TemplateEngine
- Author:
- jamesdbloom
-
Method Summary
Modifier and TypeMethodDescription<T> TexecuteTemplate(String template, HttpRequest httpRequest, Class<? extends DTO<T>> dtoClass) <T> TexecuteTemplate(String template, HttpRequest httpRequest, HttpResponse httpResponse, Class<? extends DTO<T>> dtoClass) renderTemplate(String template, HttpRequest httpRequest) Renders a template against the request and returns the raw rendered text, without attempting to deserialize it into anHttpResponse/HttpRequest.default StringrenderTemplate(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.
-
Method Details
-
executeTemplate
-
executeTemplate
<T> T executeTemplate(String template, HttpRequest httpRequest, HttpResponse httpResponse, Class<? extends DTO<T>> dtoClass) -
renderTemplate
Renders a template against the request and returns the raw rendered text, without attempting to deserialize it into anHttpResponse/HttpRequest. Used to template the contents of aFileBodyso an externally stored response body can contain template placeholders. Supported by the text-based engines (Velocity, Mustache). -
renderTemplate
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). Wheniterationisnullthis is identical torenderTemplate(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 texthttpRequest- the request contextiteration- the per-iteration variable, ornullfor no iteration context
-