?
Solved

Sending response to user when session has timed out

Posted on 2006-05-05
3
Medium Priority
?
208 Views
Last Modified: 2010-04-01
Hello - I would like to send a message to a user saying their session has timed out when their session on the server has expired (basically sending a response without a request - many banking applications do this).  I was thinking to store relevant information from the request in the session when it is created and use HttpSessionBindingListener to trigger the response when the session has expired.  Any ideas on what information I need to get from the request and how I would generate and send the response?  Any better ideas?
0
Comment
Question by:sb1977
3 Comments
 
LVL 11

Accepted Solution

by:
fargo earned 1275 total points
ID: 16614398
well, this can be done other way round. Like in your web page, check for the session identity and see if it is invalid or expired and then show an information page or expiry message to the user. Generally this can be achieved by having either a

Servlet Filter for session check
other examples are explained here, but it will give u pointers about how to use in your case
http://www.onjava.com/pub/a/onjava/2003/11/19/filters.html

OR
having a custom jsp tag lib in each page which first check if the session is valid.
0
 
LVL 28

Expert Comment

by:rrz
ID: 16615134
I agree with fargo that you have to do this the other way around.  You could have a frame or an iframe keep refreshing itself or use AJAX.  Look at  
http://java.sun.com/developer/technicalArticles/J2EE/AJAX/     
Basically you will keep sending requests to a servlet or JSP that will check to see if the session is still valid.   rrz

0
 

Author Comment

by:sb1977
ID: 16615358
Thanks for your help.  I just did a test on the bank page I was using and found out that the generated message is displayed using Javascript and no new request or response is even generated.  I think I will do this in combination with with server side check that uses the session.isNew() method to see if a session existed at a particular point in the application.

Thanks again!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Applications for our next round of the Experts Exchange Scholarship Contest are starting to roll in. It made us wonder what our past winners are up to these days. Here's a look at what four winners experienced with the contest and what they're doing…
Strategic internal linking is often considered an SEO power technique, especially for content marketing. Do you need to hire an SEO agency to optimize you internal linking? No, this article will help you understand the basics of internal linking and…
Screencast - Getting to Know the Pipeline
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question