Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Login Filter with Vaadin application
I want to use Servlet Filter to do authentication, but I fail to implement it correctly. Filter is dispatched for every request to the application, except the login page itself. If the user is not authenticated, he is redirected to login form using
HttpServletResponse.sendRedirect()
instead of normal processing.
The problem is with session expiration. After this happens, normally "Session expired" warning is displayed. Now, "Communication problem" with Syntax error message and the contents of the login form below. The server response is apparently interpreted as JSON.
My problem is how to correctly implement forward to login. Currently, I return HTTP 403 Forbidden, which, at least, does not show strange syntax errors. Has anyone implemented this?
Here is a partial solution: https://vaadin.com/forum/-/message_boards/view_message/1057035