tapestry-user@jakarta.apache.org
[Top] [All Lists]

Re: Howard, your thoughts, idea for Visit and Engine enhancement.

Subject: Re: Howard, your thoughts, idea for Visit and Engine enhancement.
From: Random Tapestry User
Date: Tue, 05 Apr 2005 21:28:08 -0500
Thanks so much Howard, just what I'm looking for !

Howard Lewis Ship wrote:

In Tapestry Picasso (4.0), each Application State Object (such as the Visit) is stored as its own HttpSession attribute (if it has session scope), and therefore can rely on normal SessionBindingListener behavior.

On Apr 5, 2005 5:12 PM, tappapp@xxxxxxxxxxx <tappapp@xxxxxxxxxxx> wrote:
After some discussion, and digging into the source code, looks like the Engine is what's stored in the HttpSession, and the Visit is stored in the Engine.

It would be nice if the Engine implemented the HttpSessionBindingListener interface and a new interface, DisposableVisit created so that when the session is unbound, the Engine can test if the Visit implements the DisposableVisit interface, and if so, calls a "dispose()" method on the Visit so developers can put their session specific cleanup in their Visit object.

I'm on a project now that uses a facade to talk to a hibernate session. After usage, the hibernate session needs to be released to the session pool. The key into the pool is a unique value assigned to the Visit object. I'd like to be able to keep a reference to that hibernate session for the duration of the user's HttpSession. This would solve that issue, with very minor coding.

Something as simple as this *should* work :

public interface DisposableVisit
{
/**
* Allow the user to clean up any session specific things.
*
*/
public void dispose();
}

And of course, in the Engine, implement the listener methods :
public void valueBound(HttpSessionBindingEvent event)
{
}

public void valueUnbound(HttpSessionBindingEvent event)
{
Object visit = getVisit();
if (visit != null && visit instanceof DisposableVisit)
{
visit.dispose();
}
}

I guess this will all blow up if the valueUnbound() is called each time the object is put in the session ... ?

PS : Thx to Richard Hensley for the ideas about hooking this into the Engine.

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: tapestry-user-help@xxxxxxxxxxxxxxxxxx






---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: tapestry-user-help@xxxxxxxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>