Hi On Mon, Jun 27, 2011 at 7:25 PM, Stephen Evanchik <[email protected]> wrote: > 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()) { > .... >
I recall adding these comments but I don't remember why I decided not to handle PUTs too - most likely it has to be fixed - will be for 2.4.2 > 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> > > ? This latter option may work. Consider trying multiparts as well Thanks, Sergey > > Thanks for any help you can offer. > > Stephen > > > -- > Stephen Evanchik > http://stephen.evanchik.com > -- Sergey Beryozkin Application Integration Division of Talend http://sberyozkin.blogspot.com
