Ok, thanks for the reply. https://issues.apache.org/jira/browse/HTTPCORE-157
I have a workaround (simply subclass ChunkedOutputStream and overwrite flush to call flushCache() followed by super.flush()), and subclassing the EntitySerializer to use it for chunked encoding. Then I create content manager like so:
final ClientConnectionManager connectionManager = new ThreadSafeClientConnManager(httpParams, schemeRegistry) {
@Override
protected ClientConnectionOperator createConnectionOperator(final
SchemeRegistry schemeRegistry) {
return new DefaultClientConnectionOperator(schemeRegistry) {
@Override
public OperatedClientConnection createConnection() {
return new DefaultClientConnection() {
@Override
protected EntitySerializer
createEntitySerializer() {
return new
MyEntitySerializer(new StrictContentLengthStrategy());
}
};
}
};
}
};
I guess this is the right way to install a different entity serializer?
Anyway, it works for now. :)
Regards,
Sebastiaan
Oleg Kalnichevski wrote:
On Wed, 2008-04-02 at 21:55 +0200, Sebastiaan van Erk wrote:Hi,I have a question on the chunked output stream: one of the nice things about chunked encoding is that you can send your data in little parts. However, flush() on ChunkedOutputStream does not flush the buffer:/** * Flushes the underlying stream, but leaves the internal buffer alone. * @throws IOException */ public void flush() throws IOException { this.out.flush(); } This is kind of against the spec of flush on OutputStream: /** * Flushes this output stream and forces any buffered output bytes * to be written out. The general contract of <code>flush</code> is * that calling it is an indication that, if any bytes previously * written have been buffered by the implementation of the output * stream, such bytes should immediately be written to their * intended destination. * ...I was wondering what the motivation was behind disabling the flush() option?To avoid tiny chunks if for some reason the output stream gets flushedtoo often.Feel free to open a bug in JIRA for this issue. OlegGenerally if a client does not want to flush the data they won't call flush, which will cause all the chunks to attain the full chunk size anyway...Regards, Sebastiaan--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
smime.p7s
Description: S/MIME Cryptographic Signature
