[EMAIL PROTECTED] wrote:

> When a Tomcat session times out does it send you to a preset error page?
> What is the mechanism there?
> What is the best way to handle timed out users?

Hi :-)  I suggest you make a object witch implements
javax.servlet.http.HttpSessionBindingListener, and put object into a session

by "setAttibute(...)", then:
- when that object is "bounded" into session, "valueBound(...) will be
called
   by container

- when the session is timeout/inValidate(...),   that object will be
"unbounded",
  then "valueUnbound(...) will be called by container


the following is a sample code from Servlet-List:

class CleanUp implements HttpSessionBindingListener{
   private String name;

   public CleanUp(String name){
      this.name = name;
   }

   public void valueBound(HttpSessionBindingEvent evt){
      System.out.println("in CleanUp, valueBound..., name="+name);
   }

   public void valueUnbound(HttpSessionBindingEvent evt){
      System.out.println("in CleanUp, valueUnBound..., name="+name);
   }
}


in MyServlet:
...
session.setAttribute( "Cleaner", new CleanUp(...) );
...

*
- if CleanUp.class is in WEB-INF/classes or in a jar file in WEB-INF/lib,
   it will be loaded by WebappClassloader
- if CleanUp.class is in TOMCAT_HOME/classes or in a jar file in
   TOMCAT_HOME/lib, it will be loaded by SharedClassloader



Bo
June 22, 2001


Reply via email to