Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New HttpSession method: getExpireTime() #406

Open
fanste opened this issue Jun 8, 2021 · 3 comments
Open

New HttpSession method: getExpireTime() #406

fanste opened this issue Jun 8, 2021 · 3 comments

Comments

@fanste
Copy link

fanste commented Jun 8, 2021

Currently I hack into the servlet implementation (here undertow) to get the expire time. Custom calculations (like lastAccessdTime + maxInactiveInterval) are not really accurate and may not reflect all implementation specific changes to that time.
I need this for a customer requirement - show a notification X minutes before the session expires.

Maybe this timestamp could be added as a new API method named getExpireTime?

@martin-g
Copy link

martin-g commented Jun 8, 2021

Usually such kind of notifications are implemented with JavaScript on the client side, because if you make a request to the server to get the remaining time you will actually refresh the session and the result will be the full timeout.

@arjantijms
Copy link
Contributor

Maybe we could add a special request type that didn't refresh the session?

@fanste
Copy link
Author

fanste commented Jun 9, 2021

The way we implemented the notification does not require an additional request. It's an company internal application that relies on websockets (Session listener which installs a task scheduled on a managed execution service which then checks the expired time as soon as the task is executed, etc...). This new method would be a great help to implement this spec compliant without checking the implementation after each server upgrade.

But I have to agree with you, martin-g. Without the separate communication channel (here websocket) it would be nearly impossible to get an accurate notification without additional requests - which then extends the session... But if the suggestion of arjantijms is possible, why not? That would be an all-embrancing solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants