Thanks Carsten, this is just what I needed.I couldn't find any documentation or any examples of this in use, so if anyone else is interested this is what you need to do to register a sitemap listener...
1. Create a class implementing org.apache.cocoon.sitemap.EnterSitemapEventListener and/or org.apache.cocoon.sitemap.LeaveSitemapEventListener
2. Define it as a spring bean in a file at config/spring/*.xml relative to your sitemap, so at COB-INF/config/spring/*.xml if you want the listener registered with a block's default sitemap. The relative path is important as the listener must be bound to a specific sitemap. Therefore if you want to attach your listener to a sub-sitemap you must put your sub-sitemap in its own directory and put the spring config relative to that.
3. That's it, all requests to that sitemap will fire the registered listeners.
Robin On 10 Dec 2007, at 13:10, Carsten Ziegeler wrote:
Robin Wyles wrote:I can't give the details, but we added sitemap listeners for things like these. Basically, you can register a listener for a specific sitemap andHi, I would like to implement something similar to Spring'sOpenSessionInViewInterceptor [1] in Cocoon 2.2 - the idea being to opena Hibernate session when specific pipelines are called, binding it tothe current thread and then closing it when the pipeline execution (andtherefore the view) has finished. I know I could use theOpenSessionInViewFilter [2], but the URL mapping is unwieldy and is notfine grained enough for my needs, and I'm not even sure if the filterwould be called when pipelines are called by other blocks (anyone know?).My first idea was to extend one of the existing pipeline implementationsbut it seems this won't work for pipelines that include calls toflowscript functions as these are handled before the pipeline is set up.Ideally I would like to enable this functionality for specific pipelines, so if anyone has any ideas about how I could go about implementing this I'd love to hear it!this is notified when the whole request has been processed by Cocoon - so you can clean up afterwards. CarstenThanks, Robin [1]http://static.springframework.org/spring/docs/2.0.6/api/org/ springframework/orm/hibernate3/support/ OpenSessionInViewInterceptor.html[2]http://static.springframework.org/spring/docs/2.0.6/api/org/ springframework/orm/hibernate3/support/OpenSessionInViewFilter.html-- Carsten Ziegeler [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
smime.p7s
Description: S/MIME cryptographic signature
