You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Patrick Heiden <pa...@gmx.de> on 2008/04/14 23:05:39 UTC
EnterSitemapEventListener
Hello together!
Is there any documentation available about usage of EnterSitemapEventListener?
Greetings,
Patrick
--
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/?mc=sv_ext_mf@gmx
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: EnterSitemapEventListener
Posted by Patrick Heiden <pa...@gmx.de>.
Hi Robin!
Much thanks for that!!
Finally I went down a different road, too ;) I followed Jörgs taste from [1] and started reusing declarative transaction management (TM). This is for the cost of prinitializing much stuff (objects with collections and the like), but I do not have to worry about OSIV or more worse, long-conversation-Impl any more ;)
I think the design is much cleaner, since TM is solely within my domain-layer (or application layer for common vocabulary ;)
But if I get frustrated with that in future, I am now able to user your approach as well - THANKS again !!
Greetings,
Patrick
[1] http://forum.springframework.org/showthread.php?t=32270&page=2
-------- Original-Nachricht --------
> Datum: Fri, 2 May 2008 10:39:55 +0100
> Von: Robin Wyles <ro...@robinwyles.com>
> An: users@cocoon.apache.org
> Betreff: Re: EnterSitemapEventListener
> Hi Patrick,
>
> I've been away, so I'm sorry I didn't see this post earlier. I am
> very busy at the moment, so please also excuse my brief reply!
>
> It's been a while since I looked at this, and in fact in the end we
> went down a radically different route on this project that didn't
> need this approach. However, before this departure, I'm pretty sure I
> managed to get all this to work. Attached is the relevant sitemap
> listener - I hope it's of some use.
>
> Regards,
>
> Robin
>
--
Psst! Geheimtipp: Online Games kostenlos spielen bei den GMX Free Games!
http://games.entertainment.gmx.net/de/entertainment/games/free
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: EnterSitemapEventListener
Posted by Robin Wyles <ro...@robinwyles.com>.
Hi Patrick,
I've been away, so I'm sorry I didn't see this post earlier. I am
very busy at the moment, so please also excuse my brief reply!
It's been a while since I looked at this, and in fact in the end we
went down a radically different route on this project that didn't
need this approach. However, before this departure, I'm pretty sure I
managed to get all this to work. Attached is the relevant sitemap
listener - I hope it's of some use.
Regards,
Robin
Re: EnterSitemapEventListener
Posted by Patrick Heiden <pa...@gmx.de>.
> Is there any documentation available about usage of
> EnterSitemapEventListener?
OK, maybe it would be helpfull to state the goals I want to achieve.
I read [1] and want/have to implement the OpenSessionInViewFilter/Interceptor for myself. Unfortunately for me, Robin left no results within his discussion ;)
So my basic idea/workflow is somewhat 'straightforward' (see [2], too):
1. Open Hibernate Session and bind it to the current thread:
Session sess = sessionFactory.openSession();
sess.beginTransaction();
//Bind the Session to the current thread/transaction
TransactionSynchronizationManager.
bindResource(sessionFactory, new SessionHolder(sess));
//Activate transaction synchronization for the current thread.
TransactionSynchronizationManager.initSynchronization();
Springs TransactionSynchronizationManager comes into play directly, because otherwise calls to getCurrentSession() would throw Exception, because LocalSessionFactory proxies Hibernate SessionFactory (in short: you have to tell what current session-context is).
2. render the view
3. commit the Session and close it (unbind it from the current Thread, too. Code example yould be found at [2])
Hopefully (as Robin stated) this won't breake calls to other sitemaps, but I would guess it wouldn't. Second idea behind that approach (away from Springs OSIV) is to use that as codebase to also implement the long-conversation-pattern and store Hibernates Session inside a users HttpSession.
And here I am left with no documentation about the Sitemap-Listeners. E.g. is the HttpSession available, or to be general, wich Objects are available inside those Listeners? I would think, that SitemapEvent.getEnvironment() would always return a HttpEnvironment at runtime, right? If so, the session could be retrieved by
ObjectModelHelper.getRequest(sitemapEvent.getEnvironment().getObjectModel()).getSession()
Still right? This is the only way I've seen so far.
So maybe there is some hidden documentation available for those Listeners, or comments on what I've tried to explain ;)
Best greetings,
Patrick
--
Psst! Geheimtipp: Online Games kostenlos spielen bei den GMX Free Games!
http://games.entertainment.gmx.net/de/entertainment/games/free
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org