tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keyur Shah <>
Subject Re: Trailer header and tomcat
Date Thu, 06 Aug 2009 16:35:19 GMT

I agree with Chris and I also appreciate Michael's dilemma.

While headers can never be added as headers once the response is committed,
the trailer headers are in fact encoded in the body itself. 

So the convention could be that if a user has specified certain trailer
headers: response.setHeader("Trailer", "SomeHeader"); and if he does set the
"SomeHeader" header before the output stream is closed:
response.setHeader("SomeHeader", "SomeValue"); then "SomeHeader" is added to
the last chunk of size 0.

With this, a chunked response could look something like this:

HTTP/1.1 200 OK
Date: Thu, 6 Aug 2009 12:53:38 GMT
Content-Type: text/plain
Transfer-Encoding: chunked
Trailer: SomeHeader

First chunk content...
Second chunk content...
Last but one chunk content...
SomeHeader: SomeValue



Christopher Schultz-2 wrote:
> Hash: SHA1
> Michael,
> On 8/6/2009 10:08 AM, Michael Ludwig wrote:
>> Christopher Schultz schrieb:
>>> When chunked encoding is being used, HTTP allows you to include
>>> "headers" after the response by including a "final chunk" with more
>>> headers for the previous chunk.
>> So those traling headers are actually footers.
> If you want to think about them that way. Technically, they are HTTP
> headers from a response that trails the HTTP response that contains the
> final bytes of the "real" response. The final chunk includes these
> headers, which have previously been indicated will follow the response
> in the final chunk.
>>> The headers you want in this chunk should be mentioned in the
>>> "Trailer" header in the previous response.
>> Or trailers.
> Still headers. In the trailer.
> - -chris
> Version: GnuPG v1.4.9 (MingW32)
> Comment: Using GnuPG with Mozilla -
> ZCcAoIxtcTbIivWrEP84qtfMoGjsYSwF
> =tMQw
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View this message in context:
Sent from the Tomcat - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message