Class VelocityTemplateEngine
java.lang.Object
org.mockserver.templates.engine.velocity.VelocityTemplateEngine
- All Implemented Interfaces:
TemplateEngine
- Author:
- jamesdbloom
-
Constructor Summary
ConstructorsConstructorDescriptionVelocityTemplateEngine(MockServerLogger mockServerLogger, Configuration configuration) -
Method Summary
Modifier and TypeMethodDescription<T> TexecuteTemplate(String template, HttpRequest request, Class<? extends DTO<T>> dtoClass) <T> TexecuteTemplate(String template, HttpRequest request, HttpResponse response, Class<? extends DTO<T>> dtoClass) renderTemplate(String template, HttpRequest request) Renders a template against the request and returns the raw rendered text, without attempting to deserialize it into anHttpResponse/HttpRequest.renderTemplate(String template, HttpRequest request, 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.
-
Constructor Details
-
VelocityTemplateEngine
-
-
Method Details
-
executeTemplate
public <T> T executeTemplate(String template, HttpRequest request, Class<? extends DTO<T>> dtoClass) - Specified by:
executeTemplatein interfaceTemplateEngine
-
executeTemplate
public <T> T executeTemplate(String template, HttpRequest request, HttpResponse response, Class<? extends DTO<T>> dtoClass) - Specified by:
executeTemplatein interfaceTemplateEngine
-
renderTemplate
Description copied from interface:TemplateEngineRenders 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).- Specified by:
renderTemplatein interfaceTemplateEngine
-
renderTemplate
Description copied from interface:TemplateEngineRenders 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 toTemplateEngine.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.- Specified by:
renderTemplatein interfaceTemplateEngine- Parameters:
template- the template textrequest- the request contextiteration- the per-iteration variable, ornullfor no iteration context
-