Re: Multiuser environment
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Friday, December 7, 2007, 1:40:56 PM, Thilo Schwarz wrote: > Hi to all, > > I would like to use freemarker in a multi user environment, where each > user has it`s own templates, macros and so on. > What's the prefered way to handle those 'multi configurations'? One > configuration object for each user? Would that be resource-saving. That's a good question (because it points to one of the design mistakes in the FreeMarker architecture). If I understand well, the users don't share templates. In that case, you might as well use a separate Configuration object for each, assuming you don't have hundreds of users. You see, the thing that can consume significant RAM in a Configuration instance is the template cache, but if they don't share templates anyway, then there will not be much redundancy. If you do have hundreds of users, then unfortunately you may need multiple "template root directories" in a single shared Configuration... and I think FreeMarker supports that if your absolute template paths look like "theRootName://everything/else/as/usual.ftl". But of course then you will need to write a custom TemplateLoader that understands these "theRootName://" prefixes -- shouldn't be a big deal to do. But then the question still remains if how will you prevent users from accessing each-other's templates, like a template inside "fred://" says "<#include "joe://my-private-template.ftl">. I guess this could only be solved inside the freemarker.cache.TemplateCache, which is not pluggable (not customizable (yeah guys, despite that we forgot to mark it as a final class... it's not designed to be extended, right?)). > Any hint or links are welcome. > Thanks > Thilo -- Best regards, Daniel Dekany ------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php