Hello
looking at HttpServletResponse
javadoc<http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/http/HttpServletResponse.html>
I
can understand that the difference between setHeader and addHeader is that
the first one overrides previous setted one (if any) and the second one just
ads the new value to an existing one (or create an new one if it doesn't
exists). I use the second in order to add to my responses Cache-Control
headers.

With something like:
response.addHeader('Cache-Control', 'public');
response.addHeader('Cache-Control', 'stale-if-error=xxx');
response.addHeader('Cache-Control', 'max-age=xxx');
response.addHeader('Cache-Control', 's-maxage=xxx');

I would expect an one line response header like Cache-Control: public,
stale-if-error=xxx, max-age=xxx, s-maxage=xxx but what I get is three
Cache-Control headers:

*$ telnet localhost 80*
*HEAD / HTTP/1.1*
*Host: some.host.com\n\n*

HTTP/1.1 200 OK
Cache-Control: stale-if-error=172800
Cache-Control: public
Cache-Control: max-age=60
Cache-Control: s-maxage=40
ETag: "custom-etag"
Content-Type: text/html;charset=UTF-8
Transfer-Encoding: chunked
Date: Fri, 23 Jul 2010 09:00:49 GMT
Server: CustomServerName

Is this the expected behavior? I've never seen such a response header
before. Should I issue a bug?

Reply via email to