Search code examples
waitfreemarker

Is there a 'wait for x seconds' command in Freemarker?


I'm working in a tool (TOPdesk) which uses Freemarker to manipulate outgoing and incoming REST API calls. One of my outgoing POST API calls simply happens too soon, so I need to artificially slow it down, and my only option is to use Freemarker. So I'm looking for a 'wait' command or something similar.


Solution

  • There's no such command in FreeMarker (out of the box). Purely in the template language, you could do a very long #list loop and #break if .now?long has changed the desired amount, but that would be absolutely horrid, as it eats lot of CPU. Actually, the whole premise (you have to wait in a template) sounds quite crazy.