Is it possible to modify the 401 response tomcat'a?

Need to add multiple headers in the 401 error. Is it possible somehow to do this?
Tried using filter:

but it do not have treatment.

Use BASIC authentication.
July 8th 19 at 15:32
1 answer
July 8th 19 at 15:34
If I understand correctly, in web.xml add

After that, all with a 401 will attempt to be redirected to my error page, however, because not authorized, then access will not receive, for this is
in your jsp add:
response.addHeader("WWW-Authenticate", "BASIC realm=\"YOUR-REALM\"");

where the realm name is the same as that in web.xml

Find more questions by tags JavaTomcat