Jtwig integration with Spring Web MVC supports template caching which allows one to speed up the rendering. Specially in the case of high usage of include and extends tags. Caching allows one to skip the file system access (to read the template) and it also skips the creation of the final structure of the template resolving all the extends, blocks and include tags, which increases the access to the file system.
Some browsers, to resolve the content encoding, use a specific header field named “Content Type“. Spring Web MVC sends a default value, which if not changed, could result in the browser rendering the output with a wrong encoding, even if one specify the value in HTML meta tags.
Some may think that this is a template engine issue, however, that’s not the way Spring works. Here I’ll show you how to change it properly.
While I was developing Jtwig, I’ve noticed that Java doesn’t have a similar strip_tags function. It was also very difficult to find a faithful implementation.
In fact, the only valid implementation I’ve found is the Resmus Stratulat’s implementation, which is simple, but different. For example, in case of comments, it will not remove the entire comment, instead it will remove just the comment tags, making the comment content visible.
As so, I’ve decided to implement the same algorithm found in PHP source.
© 2019 Joao Melo's Blog | Theme by Eleven Themes