Redirecting after session expires

Advertisement
November 30

Hi
i have a user session object which implements HttpSessionBindingListener.
what i would like it to do is when the unBound method is triggered, i want it to be directed to a logoff page. This process was created to automatically log off the users which closed down their browsers.
However, when the session expires and this object is unBound, i have not been able to find a way to get it to redirect ot the logoff page.
is there any way to do this??
Or possibly some other way of listening for the session expiration and to redirect to the logoff page??
Here is the code of the session object.
public class UserSession implements HttpSessionBindingListener{  
private String userid;
public String getUserid(){
return userid;
public void setUserid(String value){
userid = value;
public void valueBound(HttpSessionBindingEvent event)
public void valueUnbound(HttpSessionBindingEvent event)
RequestDispatcher rd = request.getRequestDispatcher("logoff");
rd.forward(request, response);
}

Advertisement

Replay

Hi,
The object that is in session and implementing HttpSessionBindingListener can only be existing with in HttpSession boundary, and There would be only one response if there is a request(Http primary rule),
As I have been using this(servlet 2.3) kind of approach in my work, I can assure that there is no chance of sending/redirecting a page to browser in this scene.
Let's think in this way..
Session will be expired in the web server only and only Servletcontext/webserver knows when it is going to be expired.. to send a page u need request( request.getRequestDispatcher("")..) object or response ( response.sendRedirect("")) objects.. So how would we get these objects in the session.
and as HTTP follows the stateless behaviour, Server would never know whom it should send page. unless there( in server) is some one (request) waiting to recieve this response..
For your question. I can suggest use page refresh meta tag that would call MyLogout.java(servlet) when certan time( 5 min) expires that means user is inactive with the application...
Hope this can help you..
cheers....

View 8 Replies

Tags:

  1. hp 2000-2313tu clean install os
  2. labview daqパルス出力
  3. migration error on macbook pro
  4. time capsule 500g default ip address
  5. download intex cloud fx pdf opener
  6. ipad A 1460 is disabled itunes
  7. Profitability Segment Number service PO
  8. CC&B xai
  9. change a miro document on hold
  10. bicycleaqv
Copyrights 2019 Fcffair BigData Resource, All rights reserved