This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

RequestDispatching when session is timed out  RSS feed

 
Martin Palm
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a web application with servlets + jsp. When the user session times out I want to be able to redirect the user to the login page. I have no problems detecting when a session is timed out. The problem comes when I try to forward/redirect the client to the login page. When I for example use:



Exactly nothing happens! No error no forwarding. When I try to forward when the session is still alive I have no problems whatsoever.

[ February 15, 2007: Message edited by: Martin Palm ]
[ February 15, 2007: Message edited by: Martin Palm ]
 
Krishna Srinivasan
Ranch Hand
Posts: 1880
Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is nothing wrong in this code. where you rae doing the session validation?
 
Martin Palm
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
re: session validation

I have tried several ways (filter, sessionListener) and all have worked in the sense that I have "caught" when the session is expired. But it has never worked to forward to anything (not even a static .html page).
 
Damodara Reddy
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try to make use of sendRedirect instead of forward, it may solve your problem.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66187
149
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Damodara Reddy:
try to make use of sendRedirect instead of forward, it may solve your problem.


Not the best of suggestions. A redirect and a forward are very different mechanisms and not always appropriate to interchange.

In any case, it's usually best to find out why something that should work is not working. It usually reveals some other problem that will crop its head up in other ways if you just sweep the unexpected behavior under the carpet. And usually at the worst possible time.

The session and the behavior of the request dispatcher are not related. There must be some other factor at work here. Please post your filter code for deeper examination.
[ February 17, 2007: Message edited by: Bear Bibeault ]
 
Martin Palm
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your replies!

Ok. The filter is copied from an other forum and modified slightly:



When the filter "filter" a request whith an expired session the following is always printed:

"SessionExpiredFilter - Expired"

But no forwarding takes place. I have tried forwarding to a static html-page as well.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66187
149
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Employ basic debugging steps.

To start with, what's the value of page when this problem occurs?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!