Best way to pass parameter to custom TemplateLoader?

Chris <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
I'm trying to implement a custom TemplateLoader for freemarker. This 
loader needs to examine the HttpServletRequest to know where to get the 
template source.

Unfortunately, Configuration.getTemplate() does not provide a way to 
pass arbitrary parameters to the TemplateLoader.

One possible solution is to use some kind of ThreadLocal scheme. I'm 
concerned that this may not work because in Jetty, our app server, 
there's some fancy nio module that handles multiple connections per 
thread, and I don't entirely understand how it works. Plus I'm 
suspicious of anything that could lead to hard-to-debug threading issues.

Another way would be to create an Environment variable and add a custom 
attribute to it, but unfortunately it appears that an Enviroment can 
only get created after the template has been created.

I'm stuck.


------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.