is there a way to find out if the http request is coming from a expired web page(IE Page which says webpage has expired). I am expiring a webpage on click of a back button. Now on the expired page, I do a refresh/or F5 and I want to take the user on a particular page with the error message. This particular page is my home page and request mapping is /homecontroller. I am trying to use a filter to achieve this but I dont have a way to know if the request is coming from the expired page or the login page. Can someone please help.
Example - Suppose there are 3 pages A(/controllerA) -> B(/controllerB) -> C(/controllerC).
In general you would need some kind of token
(parameter) passed from page B to page C to validate that request is not expired.
This would be proposed flow:
- on transition from A to B, you set in session attribute like 'expectedToken' = n
- page B on transition to C, sends also this token (eg via request parameter in GET, or hidden in POST)
- controller C, you check if expectedToken
from request is same as in session and increment expectedToken
in session. If token from request is the same as in session your transition is valid, if tokens didn't match then it was resend from expired page (since browser will use old token value, and you will have already incremented one in the session).