On 04/06/20 3:49, "mike" <[EMAIL PROTECTED]> wrote: > There are ways, if you are so adamant about this that you want to use a lot > of resources. Are you? > > At 04:53 PM 6/19/2004, Bill Siggelkow wrote: >> AFAIK this cannot be done -- your best bet is to provide a Logoff link and >> a reasonable session timeout. >> >> ksitron wrote: >>> Is there a way to detect when the user closes the browser. >>> What I want to do is do clean-up and destroy the session. >>>
This will help you clean-up and destroy the session. If you already know how to accomplish this... Then skip this reply... :) I donšt know the objective you want to accomplish but I had to implement a UserContainer that was session aware. All I had to do is implement the HttpSessionBindingListener on this class. http://jakarta.apache.org/tomcat/tomcat-5.0-doc/servletapi/javax/servlet/htt p/HttpSessionBindingListener.html By default, when you destroy the session all attributes are destroyed but not closed (example: a database connection may still persist but the session itself doesn't). The best way to clean-up/close resources is to define a ApplicationContainer with a "private Map map = new HashMap();" and then implement something similar to HttpSession "public final void setAttribute(final String key, final Object value)" "public final getAttribute(final String key)" and the "public void valueUnbound(HttpSessionBindingEvent event)" you could also implement this method "public void valueBound(HttpSessionBindingEvent event)" to initalize container's configurations/resources. When a user logs off you just to remove the ApplicationContainer from session and the unbound method will be called. When a session times out the ApplicationContainer will be removed from session and the unbound method will be called. Pedro Salgado --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]