A common approach to this is to wrap the response with your own class that overrides the setHeader method.
This is common enough that the
servlet spec provides an HttpServletRequestWrapper, and an HttpServletResponseWrapper class to help eliminate a lot of dumb typing.