[ 
https://issues.apache.org/jira/browse/WW-5690?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Work on WW-5690 started by Lukasz Lenart.
-----------------------------------------
> Remove core's FreeMarker dependency from DefaultDispatcherErrorHandler
> ----------------------------------------------------------------------
>
>                 Key: WW-5690
>                 URL: https://issues.apache.org/jira/browse/WW-5690
>             Project: Struts 2
>          Issue Type: Task
>          Components: Core
>            Reporter: Lukasz Lenart
>            Assignee: Lukasz Lenart
>            Priority: Major
>             Fix For: 7.4.0
>
>
> Part of the WW-5689 lean-core work, but self-contained and shippable in 7.x.
> *Scope note.* This is about _core's own_ dependency on FreeMarker. 
> Applications using the Struts tag library still require FreeMarker 
> regardless: {{struts.ui.templateSuffix}} defaults to {{ftl}} and all 129 
> bundled theme templates are {{.ftl}}. What these tickets buy is that a 
> REST/JSON-only application — one that never renders a tag — stops paying for 
> FreeMarker.
> h2. Current behaviour
> {{DefaultDispatcherErrorHandler}} renders the dev-mode error report through 
> FreeMarker:
> * it holds an injected {{FreemarkerManager}}
> * {{init(ServletContext)}} calls {{freemarkerManager.getConfiguration(ctx)}} 
> and loads {{/org/apache/struts2/dispatcher/error.ftl}}
> * only {{handleErrorInDevMode(...)}} ever uses the resulting template
> {{init()}} is *unconditional*. It runs at dispatcher startup and initialises 
> the whole FreeMarker configuration even in production mode, where the 
> template is never rendered — {{handleError(...)}} goes to 
> {{sendErrorResponse(...)}} and delegates to the container's error page.
> h2. Proposal
> Render the dev-mode error report without FreeMarker — a plain Java renderer 
> is sufficient for what {{error.ftl}} produces.
> Failing that, the minimum acceptable change is to make the template load lazy 
> and gate it on devMode, so a production deployment never touches FreeMarker 
> through this path.
> {{DispatcherErrorHandler}} is already a pluggable bean, so a FreeMarker-based 
> handler can remain available for anyone who has customised {{error.ftl}}.
> h2. Compatibility
> {{error.ftl}} is an internal template, not a documented extension point. If 
> the plain renderer lands, note the change in the migration guide for anyone 
> who has overridden it.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to