On Wed, 2018-05-02 at 10:59 +0200, Kenan Esau wrote:
> Hello,
> 
> I am trying to generate a chunked response. I tried different ways -
> but all have the same problem. The result is only sent to the client
> after the underlying stream is closed (or the encoder if I use
> HttpAsyncResponseProducer).
> 
> My suspicion is that this is related to the some buffers „in
> between“. Is there a possibility to flush my chunks? Can you point me
> to an example?
> 

Hi Kenan


The chunk transfer encoder used by HttpCore NIO does not immediately
write out small data chunks to the underlying channel if they are below
so called 'fragment size hint' value: 

https://github.com/apache/httpcomponents-core/blob/4.4.x/httpcore-nio/s
rc/main/java/org/apache/http/impl/nio/codecs/ChunkEncoder.java#L127

There is no means of flushing session output buffer from a
HttpAsyncResponseProducer implementation but one can set 'fragment size
hint' value to zero in order to force all chunk data to get committed
to the channel immediately (at the expense of IP packet fragmentation).

https://github.com/apache/httpcomponents-core/blob/4.4.x/httpcore/src/m
ain/java/org/apache/http/config/ConnectionConfig.java#L146

Hope this helps

Oleg


> Regards
> 
>     Kenan
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to