This filter is useful if you want to be able to progressively transform a static site into a dynamic site. Typically, it happens when a designer gives to the coder a static model of a site where the links between pages are functionnal but the data shown inside are frozen.

Storing the regular files and the templates in different directory trees is feasable but really painful for the coder.

Thus, we need to store the templates and the regular files in the same directory tree, distinguishing templates with a supplementary ".vtl" extension, but without breaking former URLs.

The purpose of this filter is to allow this naming convention (foo.html and bar.html.vtl) while hiding .vtl from URLs (/foo.html and /bar.html): it will add ".vtl" when the target resource is a template.

Source file: TemplateNameFilter.java

  • No labels