Re: dispatcher POST-processing
Last thing about this... I found something about performance: I did it with de "tapestry-hibernate way", this is using the PerThreadManager. I thought it was going to be the same or better, but NO, it's the *same* as doing the RequestFilter way, I mean, for every asset (js, css) it will try to close the hibernate session, because every asset is a diferent request (and a diferent thread). In the source of "interface PerthreadManager" we can read this: [...]so that they can clean up any per-thread/per-request state. [...] So, per thread it's the same as per request. Conclusion: I rolled back to my dispatcher solution, it closes de session after the complete render of current page (it doesn't interfere with assets) so it's more efficient. Hope this idea helps someone, bye On Wed, Nov 25, 2009 at 11:20 PM, Alfonso Quiroga wrote: > In my case I don't open the session programatically, the session opens > when it's needed (getCurrentSession() bounded to current thread). I > think the only diference is closing the session... I do it inside the > dispatcher, and tapestry-hibernate is better (as you say) because it > closes when the thread ends. Thanks > > On Wed, Nov 25, 2009 at 11:12 PM, Robert Zeigler wrote: >> I think you're going at this the wrong way, in this particular instance. >> I think you'd be better off to do this the way tapestry-hibernate does it. >> Basically, you instaniate the session the first time it's needed, and then >> use PerThreadManager to clean up the session at the end of the thread (ie at >> the end of the request). >> >> Robert >> >> On Nov 25, 2009, at 11/256:42 PM , Alfonso Quiroga wrote: >> >>> Answering to myself :) >>> >>> It is possible to *override* dispatchers... in this case, I did >>> override "PageRender". >>> In contributeMasterDispatcher(...) I added : >>> configuration.overrideInstance("PageRender", MyDispatcher.class); >>> >>> where MyDispatcher is the similar to PageRenderDispatcher (default) >>> but after rendering... I close current hibernate session. >>> Hope overriding dispatchers is util for someone else. Bye >>> >>> On Wed, Nov 25, 2009 at 9:05 PM, Alfonso Quiroga >>> wrote: Hi, I made a dispatcher for web-security and it really works fine. As I'm not using tapestry-hibernate, I want to create a dispatcher for opening and closing hibernate-sessions. By now I did it with a RequestFilter and works fine, the problem is that the RequestFilter filters *everything*, assets, etc. As I want a filter only for pages, I am thinking in a dispatcher, but the problem is that in the dispatcher (I think) I can't do post processing. I need something like 1. openHibernateSession() 2. process page-request 3. close hibernate session By now I can NOT do it because dispatcher just returns true or false, and I can't do post processing. Any suggestions? thanks in advance >>> >>> - >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> > - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: dispatcher POST-processing
In my case I don't open the session programatically, the session opens when it's needed (getCurrentSession() bounded to current thread). I think the only diference is closing the session... I do it inside the dispatcher, and tapestry-hibernate is better (as you say) because it closes when the thread ends. Thanks On Wed, Nov 25, 2009 at 11:12 PM, Robert Zeigler wrote: > I think you're going at this the wrong way, in this particular instance. > I think you'd be better off to do this the way tapestry-hibernate does it. > Basically, you instaniate the session the first time it's needed, and then > use PerThreadManager to clean up the session at the end of the thread (ie at > the end of the request). > > Robert > > On Nov 25, 2009, at 11/256:42 PM , Alfonso Quiroga wrote: > >> Answering to myself :) >> >> It is possible to *override* dispatchers... in this case, I did >> override "PageRender". >> In contributeMasterDispatcher(...) I added : >> configuration.overrideInstance("PageRender", MyDispatcher.class); >> >> where MyDispatcher is the similar to PageRenderDispatcher (default) >> but after rendering... I close current hibernate session. >> Hope overriding dispatchers is util for someone else. Bye >> >> On Wed, Nov 25, 2009 at 9:05 PM, Alfonso Quiroga >> wrote: >>> >>> Hi, I made a dispatcher for web-security and it really works fine. As >>> I'm not using tapestry-hibernate, I want to create a dispatcher for >>> opening and closing hibernate-sessions. >>> By now I did it with a RequestFilter and works fine, the problem is >>> that the RequestFilter filters *everything*, assets, etc. >>> As I want a filter only for pages, I am thinking in a dispatcher, but >>> the problem is that in the dispatcher (I think) I can't do post >>> processing. I need something like >>> 1. openHibernateSession() >>> 2. process page-request >>> 3. close hibernate session >>> >>> By now I can NOT do it because dispatcher just returns true or false, >>> and I can't do post processing. Any suggestions? thanks in advance >>> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org > > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: dispatcher POST-processing
I think you're going at this the wrong way, in this particular instance. I think you'd be better off to do this the way tapestry-hibernate does it. Basically, you instaniate the session the first time it's needed, and then use PerThreadManager to clean up the session at the end of the thread (ie at the end of the request). Robert On Nov 25, 2009, at 11/256:42 PM , Alfonso Quiroga wrote: Answering to myself :) It is possible to *override* dispatchers... in this case, I did override "PageRender". In contributeMasterDispatcher(...) I added : configuration.overrideInstance("PageRender", MyDispatcher.class); where MyDispatcher is the similar to PageRenderDispatcher (default) but after rendering... I close current hibernate session. Hope overriding dispatchers is util for someone else. Bye On Wed, Nov 25, 2009 at 9:05 PM, Alfonso Quiroga > wrote: Hi, I made a dispatcher for web-security and it really works fine. As I'm not using tapestry-hibernate, I want to create a dispatcher for opening and closing hibernate-sessions. By now I did it with a RequestFilter and works fine, the problem is that the RequestFilter filters *everything*, assets, etc. As I want a filter only for pages, I am thinking in a dispatcher, but the problem is that in the dispatcher (I think) I can't do post processing. I need something like 1. openHibernateSession() 2. process page-request 3. close hibernate session By now I can NOT do it because dispatcher just returns true or false, and I can't do post processing. Any suggestions? thanks in advance - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: dispatcher POST-processing
Answering to myself :) It is possible to *override* dispatchers... in this case, I did override "PageRender". In contributeMasterDispatcher(...) I added : configuration.overrideInstance("PageRender", MyDispatcher.class); where MyDispatcher is the similar to PageRenderDispatcher (default) but after rendering... I close current hibernate session. Hope overriding dispatchers is util for someone else. Bye On Wed, Nov 25, 2009 at 9:05 PM, Alfonso Quiroga wrote: > Hi, I made a dispatcher for web-security and it really works fine. As > I'm not using tapestry-hibernate, I want to create a dispatcher for > opening and closing hibernate-sessions. > By now I did it with a RequestFilter and works fine, the problem is > that the RequestFilter filters *everything*, assets, etc. > As I want a filter only for pages, I am thinking in a dispatcher, but > the problem is that in the dispatcher (I think) I can't do post > processing. I need something like > 1. openHibernateSession() > 2. process page-request > 3. close hibernate session > > By now I can NOT do it because dispatcher just returns true or false, > and I can't do post processing. Any suggestions? thanks in advance > - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org