servlet filter is even worse. Since servlets may flush the response, they disallow later addition of response headers. so we have to do best effort to write our generated headers at least.