jersey/jersey — pull request #33 by mss (2013-10-05 11:19:42+00:00)
Title: JERSEY-2128: Don't always use chunked encoding in apache-connector.

The Jersey 2.x ApacheConnector has the same problem as 1.x (cf. JERSEY-2126):
Chunked encoding is always enabled when sending data, which doesn't work
with all servers (eg. lighttpd 1.4).

This patch disables chunked encoding per default as specified in the JavaDocs
for ClientProperties.CHUNKED_ENCODING_SIZE and only enables it if that
property is set to a non-zero (and non-null) value.

It always uses the default chunk size even for positive values since setting
an actual value is a bit more complicated. Maybe the code should log a
warning when this happens.

This implementation uses a BufferedHttpEntity, alternatively it could use
the ClientRequest's own buffer capability if I understood how to use that.