I think that's expected behaviour: You can't set headers after the response has been committed (more body data has been written to the outputstream than the buffer size).

In the case of the 200 response code the call to filterChain.doFilter(...) actually serves the content. Setting of the header after this is too late.

Jon

[EMAIL PROTECTED] wrote:
Hello

I do some further analysis in this problem and got following result:

Precondition: The filter manipulates the HTTP header when returning a
static resource (e.g. image).

HTTP 200
In case of a HTTP 200 (OK) result the header is not added when the doFilter
method is like following:
....
filterChain.doFilter(request, response);
response.setHeader(name, value);
....

In contrast to it works when the code is like following:
....
response.setHeader(name, value);
filterChain.doFilter(request, response);
....

In other words: When returning a HTTP 200 (OK) I must set the header before
forwarding the request to the next filter.

HTTP 304
In this case it doesn't mention whether setting the header is before or
after forwarding the request.

Any comments?

Jürgen Dufner


-----------------------------------------
Diese E-Mail enthaelt vertrauliche oder rechtlich geschuetzte
Informationen.
Wenn Sie nicht der beabsichtigte Empfaenger sind, informieren Sie bitte
sofort den Absender und loeschen Sie diese E-Mail. Das unbefugte
Kopieren
dieser E-Mail oder die unbefugte Weitergabe der enthaltenen
Informationen
ist nicht gestattet.

The information contained in this message is confidential or protected
by
law. If you are not the intended recipient, please contact the sender
and
delete this message. Any unauthorised copying of this message or unauthorised distribution of the information contained herein is
prohibited.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to