How can I force a 401 response code instead of a 500?
posted 10 years ago
I have a filter which performs authentication on requests. Currently I throw a ServletException in the case where the request fails to authenticate. This results in a 500 response code, and instead I'd like to have a 401 (Unauthorized) response code in this case. Is there a way to do this?