I've been looking at the issue of handling expired sessions, by directing the user to
a "you've been
logged out" (jsp) page but am having trouble understanding one thing. If a session has
expired, it
looks like you can not get a RequestDispatcher. In that case, how do you forward the
user to the
"LoggedOut.jsp" page?
---Raymond
haran Iyer wrote:
>
> Hi, In HttpSession you have a methods to find out
>
> since when the session has begun and how long (in ms)
> it has been in action. Also you have methods to find
> out how long the session has not been active too.
> calculatin these parameters and appropriately reducing
> from the total session time, you can arrive at the
> required solution. Have you explored this. Let me know
> if you need further details.
>
> Haran from India
>
> --- Raymond Blum <[EMAIL PROTECTED]> wrote:
> > Thanks! I can see this doing what I need and a lot
> > more that i hadn't yet addressed.
> >
> > ---Raymond
> >
> > Pavel Veller wrote:
> > >
> > > 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