RB> Hi there
RB> I have a servlet (part of a web appl in JRun 3.0SP2 under Linux) that I would
like to have detect
RB> when a user's session has timed out (i.e. the web application session timeout has
been reached)
RB> Currently I know that this has happened when my servlet attempts to get a
RequestDispatcher with...
RB> "getServletContext().getRequestDispatcher(..."
RB> ....and gets a NULL back.
RB> I would like like a clearer way of detecting that the user session is invalid/has
timed out than
RB> just the NULL RD since presumable the null RD could have been a result of other
problems as well.
RB> Any help or pointers greatly appreciated!
RB> ---Raymond
You can do as follows: (We use this solutions for logging User sessions):
1)
public class UserSession {
....
public boolean begin() {
.. session started
}
public boolean end() {
... session ended / invalidate
}
}
2)
final public class HttpUserSession extends UserSession implements
javax.servlet.http.HttpSessionBindingListener {
public HttpUserSession(){
super();
....
}
public void valueBound(javax.servlet.http.HttpSessionBindingEvent event) {
if (!begin()) {
// log "can not start session tracking"
}
}
public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent event) {
if (!end()) {
// log "can not finish session tracking"
}
}
}
3)
in jsp code: (login_action.jsp)
session.setAttribute(HttpUserSession.class.getName(), new HttpUserSession());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists