Hi everyone,
I am using CXF 2.4.0 and having trouble issuing a PUT with a large
payload (100MB+ but this is dependent on the JVM heap size). I receive
an OutOfMemoryError originating from
sun.net.www.http.PosterOutputStream because the Content-Length is not
sent and chunking is not enabled.
My question: How can I stream the data in the circumstances when I
know the entity length and enable chunking when I do not know the
entity length?
I have traced the code and found that in HTTPConduit.java the
following TODO is present:
public void prepare(Message message) throws IOException {
....
// DELETE does not work and empty PUTs cause misleading exceptions
// if chunking is enabled
// TODO : ensure chunking can be enabled for non-empty PUTs -
if requested
if (connection.getRequestMethod().equals("POST")
&& csPolicy.isAllowChunking()) {
....
which seems to indicate that there is no way to accomplish this
without modifying HTTPConduit. Is that correct?
Could I create an implementation of AbstractPhaseInterceptor bound to
Phase.PREPARE_SEND_ENDING and use:
HttpURLConnection conn = message.get(HttpConduit.KEY_HTTP_CONNECTION);
configure(conn);
message.setContent(OutputStream.class, <Stream implementation
that does what I want with conn>
?
Thanks for any help you can offer.
Stephen
--
Stephen Evanchik
http://stephen.evanchik.com