Now, the interesting part, Please see the attached file.
Now, what happens when my session expires (due to inactivity) and I click on any of the tabs , it opens up the login page into that 'Main body part'. But I am actually redirecting the request, should not it change the browser URL and load the login page?
Because I can see my login page into that Right conditional Part (which I referred as Main Body Part) as well as I can see from the log that it goes into that if condition and prints logger statement.
There's something about "Ajax" in that image you posted. If you see the login page appearing inside a frame in your browser, then that means that the request for the login page came from that frame.
Paul Clapham wrote:There's something about "Ajax" in that image you posted. If you see the login page appearing inside a frame in your browser, then that means that the request for the login page came from that frame.
That images shows the JSP staructure. We have used AJAX there. When you click on any tab/link link on left portion of JSP , it updates (through AJAX) the right side portion of the JSP. Now I have implemented filter to make sure that when user session expires due to inactivity, and then user click on some link, she should be taken to login page. That happens right now. But rather doing *sendRedirect* it just loads the login page in that right side portion of the page. If you see my filter code, I have written sendRedirect and logs on server confirms that it goes into that method.
ok, nowadays AJAX is used in almost every app. Do you use that?
How do you manage if session expires automatically? Do you redirects to login page?
If you use ajax and do redirect then how did you implement that? (any way other than the way have implemnted?)
I use lots and lots of Ajax. Whenever the authentication filter detects that the user requires authentication, it returns a custom status code in the response (555 to be exact). The client detects this status code and initiates the login protocol.
This is incredibly easy to implement if you are using something like jQuery to do your Ajax, as you can establish a global event handler for all Ajax errors rather than testing it each and every time.