[ 
https://issues.apache.org/jira/browse/WW-4145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13726335#comment-13726335
 ] 

Jasper Rosenberg commented on WW-4145:
--------------------------------------

Thanks :) 

That is where I started, but I ended up with it in the FreemakerTemplateEngine 
for 2 reasons:

1. The FreemarkerManager package had no theme/tag awareness that I could see, 
so it seemed odd to make it less generic.  We would have to inject the 
FreemakerTemplateEngine into the manager to pass to the 
FreemarkerThemeTemplateLoader, or use the container to construct the 
FreemarkerThemeTemplateLoader and have it injected that way (along with the 
uiThemeExpansionToken).

2. If a subclass of FreemarkerManager needs to replace the config template 
loader (which I do periodically when dynamically changing A/B tests), it is 
more fragile because the subclass needs to know to put the 
FreemarkerThemeTemplateLoader back on top.  We could probably make that clearer 
with some documentation and explicit hooks for that case though.

I do think there are some strong advantages to your suggestion, namely that we 
wouldn't need the synchronized block, which technically isn't sufficient anyway 
since it doesn't keep someone else in another thread from setting the template 
loader while you are in the synch block.

I will create an alternate patch with this approach and you can decide which 
you prefer.
                
> file.ftl in xhtml theme directly references xhtml controlfooter.ftl
> -------------------------------------------------------------------
>
>                 Key: WW-4145
>                 URL: https://issues.apache.org/jira/browse/WW-4145
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Other
>    Affects Versions: 2.3.15.1
>            Reporter: Jasper Rosenberg
>            Assignee: Lukasz Lenart
>              Labels: freemarker, tags, xhtml
>             Fix For: 2.3.16
>
>         Attachments: ThemeExpansion.patch
>
>
> Should use $\{parameters.theme} instead so can be used in theme extension.
> {code}
> <#include "/${parameters.templateDir}/${parameters.theme}/controlheader.ftl" 
> />
> <#include "/${parameters.templateDir}/simple/file.ftl" />
> <#include "/${parameters.templateDir}/${parameters.theme}/controlfooter.ftl" 
> />
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to