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

Fix #25216 Redirection does not work after session timeout in Admin Console #25217

Merged
merged 2 commits into from
Nov 20, 2024

Conversation

tnagao7
Copy link
Member

@tnagao7 tnagao7 commented Nov 19, 2024

Fixes #25216 .

This fix adds an exception handler for the Admin Console to handle jakarta.faces.application.ViewExpiredException.
For Ajax requests, since forwarding/redirection methods of JSF do not work as expected, this fix uses redirection by windows.location.href as workaround.

- Add an exception handler for the Admin Console to handle jakarta.faces.application.ViewExpiredException and to redirect the page when session timeout.
- For ajax requests, since forwarding/redirection methods of JSF do not work as expected, this fix uses redirection by windows.location.href as workaround.

Signed-off-by: Takahiro Nagao <nagao.takahiro@fujitsu.com>
if (facesContext.getPartialViewContext().isAjaxRequest()) {
facesContext.getExternalContext().getResponseOutputWriter().write(
"<script type='text/javascript'>"
+ "window.location.href = '" + facesContext.getExternalContext().getRequestContextPath() + "/';"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be stored in a variable and reused on line 53.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've corrected it.

Signed-off-by: Takahiro Nagao <nagao.takahiro@fujitsu.com>
@dmatej dmatej added this to the 7.0.20 milestone Nov 20, 2024
@dmatej dmatej added the bug Something isn't working label Nov 20, 2024
@dmatej dmatej merged commit 1eb9920 into eclipse-ee4j:master Nov 20, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redirection does not work after session timeout in Admin Console
3 participants