ninjaframework / ninja

Ninja is a full stack web framework for Java. Rock solid, fast and super productive.
http://www.ninjaframework.org
Apache License 2.0
1.91k stars 521 forks source link

Retrieve url path from template #747

Open danielsawan opened 2 years ago

danielsawan commented 2 years ago

Hello,

I am looking for a way to get the actual URL from the freemarker template without using the Results.render(). I want it to be global. I thought the Implicit functions ${contextPath} would do the trick but i got an empty result. I also tried to use the TemplateEngineFreemarker and the setSharedVariable on each route request in Ninja.java but it gets overwritten if multiple requests run in parallels (not threadsafe or not for this type of usage).

And now I have no idea to do it. Any help is appreciated.

Thanks !