[
https://issues.apache.org/jira/browse/TOMAHAWK-1319?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12625806#action_12625806
]
Leonardo Uribe commented on TOMAHAWK-1319:
------------------------------------------
I don't see a case why you could have two templates with same name, locale and
encoding.
In other field, there is some code related to the ClassTemplateLoader (Why it
pass the renderer class as base for find templates? if an instance is saved on
app scope, what happen when it is used by two renderers?)
I'll take a look in deep.
> DefaultTemplateEncoder does not cache FreeMarker templates
> ----------------------------------------------------------
>
> Key: TOMAHAWK-1319
> URL: https://issues.apache.org/jira/browse/TOMAHAWK-1319
> Project: MyFaces Tomahawk
> Issue Type: Bug
> Components: Template Renderer
> Affects Versions: 1.1.7-SNAPSHOT
> Environment: tomcat 6.0.16
> java 1.6.0_05
> MyFaces tomahawk-sandbox-1.1.7-SNAPSHOT
> Reporter: Paul Rivera
> Priority: Minor
> Attachments: DefautlTemplateEncoder-Caching.patch
>
>
> The DefaultTemplateEncoder used by TemplateRenderer does not cache the
> templates properly.
> In DefaultTemplateEncoder.encodeTemplate(), it instantiates a new
> Configuration instance every time this method is called. FreeMarker's cache
> is stored in Configuration->TemplateCache->CacheStorage. If we keep creating
> a new instance of Configuration in DefaultTemplateEncoder.encodeTemplate(),
> the CacheStorage will always be empty and FreeMarker will have to parse the
> file again.
> Here's the code:
> public class DefaultTemplateEncoder implements TemplateEncoder {
> private static final Log log =
> LogFactory.getLog(DefaultTemplateEncoder.class);
> private static final String TEMPLATE_DIRECTORY = "template";
> public void encodeTemplate(FacesContext context, UIComponent component,
> Renderer renderer, String template, Object dataModel) throws IOException {
> Configuration cfg = new Configuration();
> if(log.isDebugEnabled())
> log.debug("Encoding template : "
> +renderer.getClass().getResource(TEMPLATE_DIRECTORY+"/"+template));
> TemplateLoader templateLoader = new
> ClassTemplateLoader(renderer.getClass(), TEMPLATE_DIRECTORY);
> ...
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.