tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Schönhaber <>
Subject Re: chunked encoding
Date Fri, 12 Jun 2009 13:29:43 GMT
André Warnier:

> In summary thus :
> - making the request be HTTP 1.0, no matter how it's done, is not going 
> to magically make Tomcat send the response in one chunk nor add a 
> Content-Length header.


> (it may just /prevent/ it from adding a "Content-transfer-encoding: 
> chunked" header, yes ?)

It may prevent it from sending chunked content (and adding the
appropriate header) in 100% of the cases, since there's no chunked
transfer encoding in HTTP/1.0. IOW, you may replace "may" with "will" in
the above sentence ;-).

> - the first-choice solution would be to have the CDN fix their software, 
> or select another CDN which can handle chunked content.

I agree.

> - the second-best would be :
> (presuming the OP knows at some point the real size of the data chunk 
> that has to be sent back.)
> Write a servlet which obtains the data, then uses 
> response.setContentLength(nnn), then does a 
> response.getWriter/getOutputStream, then writes the data there. Yes ?
> - if the above is not acceptable/practical, then another solution would 
> be to intercept and buffer the full response somewhere, calculate its 
> size, and then forward it unchunked, preceded by a proper Content-Length 
> header.

I just noticed that the OP said he was going to experiment with setting
the bufferSize attribute of the AJP Connector to a higher value.
That might indeed be the easiest workaround - provided the output his
servlets/JSPs generate do not exceed the buffer size - and this
attribute really does what I understand it does.
Using ServletResponse#setBufferSize, which I already mentioned, might
work too - on an per servlet level. But if increasing the value of the
bufferSize attribute of the Connector works, it's much less hassle.


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

View raw message