Transfer-Encoding: chunked

Vicky picture Vicky · Nov 11, 2013 · Viewed 58.5k times · Source

I was trying to understand more on Transfer-Encoding:chunked. referred some articles: http://zoompf.com/blog/2012/05/too-chunky and "Transfer-Encoding: chunked" header in PHP.

I still didn't get very clear picture. I understand setting this encoding allows server to set content in chunk to the browser and cause partial rendering of content at a time that makes web site responsive.

If I've a web application that serves dynamic content (ex: JSF based web app) hosted on IBM WAS, most of the web pages are designed to server rich static content with lots of CSS and JS files + dynamic content. How can I set transfer-encoding 'chunked' for my pages? Or in other words:

  • How do you decide which page will have 'Transfer-Encoding: chunked' and how do you set it for that page?

Your personal experience will certainly be valuable for my understanding.

Answer

Julian Reschke picture Julian Reschke · Nov 11, 2013

Transfer-Encoding: chunked isn't needed for progressive rendering. However, it is needed when the total content length is unknown before the first bytes are sent.