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.
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
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?