Spring Boot : How to httpSession.invalidate() after return statement?

119 Views Asked by At

I am working on internationalization in Spring boot. Is it possible to httpSession.invalidate() after returning a page.

As an example

        try {
            return "finalPage";
        }finally {
            httpSession.invalidate();
        }

What I am trying to do is to show finalPage.html with selected language option first, after clear the session.

But this example first clears the session and then shows the finalPage.html in English not selected Italian. Which means if I choose Italian language for the firstPage.html I expect finalPage.html also in Italian language not default English.

Is it possible the above code example work the way as I wish?

Note: I have achieved my wish by using Thymeleaf tags, I want to do this on the java side if possible.

0

There are 0 best solutions below