jersey
jersey copied to clipboard
jdk-connector can not stream when POST/PUTing an entity with a known size
It looks like the jdk-connector does not stream a request entity when the Content-Length is known: it has to be buffered or chunked, whereas the HttpUrlConnector can (albeit incredibly slowly because of the default 8KB buffer size) transfer an input stream directly when the content length is set on the request.
Having said this, this is fairly minor as the chunked support seems decent and the back-end I'm talking to (openstack swift) is happy to accept a chunked request.
(Sorry, last one I hope)
The entity is either chunked when requested so, or buffered, otherwise. When I try to send InputStream
and set the Content-Length
header, it cannot reproduce your issue.
The HttpUrlConnector
uses 4KB default buffer, but you can set the size, for instance by
ClientConfig config = new ClientConfig();
config.connectorProvider(new HttpUrlConnectorProvider().chunkSize(BUFFER_SIZE));