On 7/25/05, Frank W. Zammetti <[EMAIL PROTECTED]> wrote:
> SessionListener is what you want.
> 
> Here's an example from one of my apps (condensed for space)... it is used
> to delete a temporary PDF that may have been generated for the user when
> they log off:
> 
> import company.app.User;
> import javax.servlet.http.HttpSession;
> import javax.servlet.http.HttpSessionEvent;
> import javax.servlet.http.HttpSessionListener;
> public class MySessionListener implements HttpSessionListener {
>  public synchronized void sessionCreated(HttpSessionEvent se) {
>  }
>  public synchronized void sessionDestroyed(HttpSessionEvent se) {
>    HttpSession sess = se.getSession();
>    User user = (User)sess.getAttribute("user");
>    String userID = user.getUserID();
>    AppHelpers.deletePDF(userID);
>  }
> }

I could be losing my mind, but, I swear that I tried this technique
once and by the time the sessionDestroyed() method was called, I was
not able to get any of the session attributes back anymore. For
various reasons, the webapps I develop need to be deployable in a
Servlet 2.3 environment. Is this something where the behavior changed
for the better in Servlet 2.4 versus 2.3?

-Van

-- 
- Mike "Van" Riper
  [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to