[quote]Hi, I've been experimenting with magnolia and I managed to create a simple website using templates, paragraphs etc. However there are a couple of things I'm currently stuck on. Could someone please help me ? The first is the creation of a new filter to add to the magnolia filter chain. I red the information at the url http://documentation.magnolia-cms.com/technical-guide/request-processing-and-filters.html and what I did was: I created a java class implementing javax.servlet.Filter
I put that class in a .jar which I put in the lib folder in the magnolia instance restarted the server I went to configuration-> server-> filters and created a new content node "mioFiltro" having the nodeData "class" with the class I created as a value. Unfortunately the filter doesn't get called together with the others. I know the class name is correct because if I try to change it to a nonexistent class I instantly get an error message in the logs. Unfortunately I expected my filter to be called at some point in the filter chain (I put it right before the "cache" filter) and it doesn't happen. It doesn't even appear alongside the other in the "initializing filters" list that get logged whenever I change something in the filters. It's like magnolia checks it for correctness, sees it's ok and then promptly forgets it. I'm guessing I should do some more configuration, but I don't know where. [/quote] Try to move your filter up in the chain; if you added it at the end, it's probably after the cms/rendering filter, and unless you've configured specific bypasses there, your filter will never be reached. [quote] the second problem is: How do I call a java class in a freemarker template? Looking around, I did find a solution at http://stackoverflow.com/questions/1362343/how-do-i-call-java-methods-on-an-object-from-a-freemarker-template, but I don't quite get how I would expose the object. [/quote] Two approaches: * global: configure a "shared variable": http://documentation.magnolia-cms.com/technical-guide/templating.html#AccessingyourownJavamethodsfromFreemarker * local: expose methods/objects via your template models. http://documentation.magnolia-cms.com/technical-guide/templating.html#Templatingsupportobjects -- Context is everything: http://forum.magnolia-cms.com/forum/thread.html?threadId=67076a7d-cc95-4443-b704-31da0d12b003 ---------------------------------------------------------------- For list details, see http://www.magnolia-cms.com/community/mailing-lists.html Alternatively, use our forums: http://forum.magnolia-cms.com/ To unsubscribe, E-mail to: <[email protected]> ----------------------------------------------------------------
