You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Freemarker supports several extension types, ftl,ftlx, and ftlh. The x and h variants activate automatic escaping for xml and html respectively.
While it is possible to change the default extension for Freemarker, it is not possible to dispatch to a view that is anything other than the default. Developers should be free to choose .ftl, .ftlx, or .ftlh as the view from within controllers, on a case-by-case basis.
Actual Behaviour
Extensions other than the default extension are not found, returning a view not found error.
It is possible to change the default extension via configuration, which allows controllers to dispatch to a different format, but this is a global change
It is possible to <#include> a view of a non-default type - this does work as expected.
Steps To Reproduce
create a new project and include micronaut views and freemarker
create a freemarker view template that has the extension .ftlh
attempt to render the view - fail
Changing the default
configure the micronaut.views.freemarker.default-extension to be ftlh in application.yml
attempt to render the view created above - success
create another route and ftl tmplate as its view
attempt to render the route with the .ftl view - failure
Environment Information
macos 14.6 on m1max
micronaut 4.4
micronaut views
freemarker
Example Application
No response
Version
4.4
The text was updated successfully, but these errors were encountered:
Expected Behavior
Freemarker supports several extension types,
ftl,
ftlx
, andftlh
. Thex
andh
variants activate automatic escaping forxml
andhtml
respectively.While it is possible to change the default extension for Freemarker, it is not possible to dispatch to a view that is anything other than the default. Developers should be free to choose
.ftl
,.ftlx
, or.ftlh
as the view from within controllers, on a case-by-case basis.Actual Behaviour
Extensions other than the default extension are not found, returning a view not found error.
This appears to be due to the viewLocation method of FreemarkerViewsRenderer always normalizing the extension to the default value.
Note:
<#include>
a view of a non-default type - this does work as expected.Steps To Reproduce
.ftlh
Changing the default
micronaut.views.freemarker.default-extension
to beftlh
inapplication.yml
ftl
tmplate as its view.ftl
view - failureEnvironment Information
Example Application
No response
Version
4.4
The text was updated successfully, but these errors were encountered: