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

37
First chunk content...
17
Second chunk content...
89
Last but one chunk content...
0
SomeHeader: SomeValue

Thoughts?

--Keyur


Christopher Schultz-2 wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> 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
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAkp68DcACgkQ9CaO5/Lv0PA1cwCcDeQZ8fGbMlbAP4JR0L7lBAE9
> ZCcAoIxtcTbIivWrEP84qtfMoGjsYSwF
> =tMQw
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Trailer-header-and-tomcat-tp24835409p24850036.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to