Reputation: 500
I want to add several headers to error response. How can I do that?
I tried use Filter
<filter>
<filter-name>Filter</filter-name>
<filter-class>com.example.filter.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
but it does not call. I use BASIC authentication.
Upvotes: 0
Views: 778
Reputation: 16635
You can't use a filter to do this because authentication takes place before the filters are invoked.
You can specify a custom error page for 401 responses in web.xml and in that page you can set whatever headers you wish.
Upvotes: 1