vertx-web icon indicating copy to clipboard operation
vertx-web copied to clipboard

Unify template engine behavior across engines

Open pmlopes opened this issue 4 years ago • 0 comments

Currently, we support several template engines, but there are a few behavior changes that are not consistent. This umbrella issue is about unifying them.

template reference should use the engine default naming conventions

Engines need to know the template default file extension and are appending or removing them from the requested filename to allow the rendering with or without extension. This has several implications:

  1. extra logic is run before each render to either add or slice the extension
  2. it can create ambiguity with files named like name.ext.ext which means that a call to name.ext can not really be uniquely identified

template default root

The base root is currently guessed from the "first" directory (string before /) of the path. This again requires some string manipulation operations which could lead to ambiguity. Engines should explicitly have a base path to resolve files.

caching

Not all engines have their cache. Other use a generic cache. We should either disable all engine cache or decide to use the engine internal one. The drawback of using the engine internal one is that we lack control on features like DEVELOPMENT mode which are managed by the generic cache for example.

context

This change has been addressed in 4.0.0 the routing context data is now the root level of the template. This means we don't force Json types, but we use a java.util.Map instead.

pmlopes avatar Feb 12 '21 13:02 pmlopes