cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Evanchik <evanc...@gmail.com>
Subject Re: OutOfMemoryError using JAX-RS Client API while PUT'ing large entities
Date Tue, 28 Jun 2011 15:36:50 GMT
On Tue, Jun 28, 2011 at 9:50 AM, Sergey Beryozkin <sberyozkin@gmail.com> wrote:
> By the way if the target server understands X-HTTP-Method-Override
> header (CXF does) then
> as a workaround you can use POST and also set
>
> X-HTTP-Method-Override: PUT

Unfortunately the server is not using CXF.

I looked at the latest CXF code:

http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?view=markup)

and was not sure what changes were made here and elsewhere that would
solve this problem. I can pull in 2.4.<LATEST> and see what changes
and report back.

Stephen


>
> Sergey
>
> On Mon, Jun 27, 2011 at 9:43 PM, Sergey Beryozkin <sberyozkin@gmail.com> wrote:
>> Hi
>>
>> On Mon, Jun 27, 2011 at 7:25 PM, Stephen Evanchik <evanchsa@gmail.com> 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
>>
>



-- 
Stephen Evanchik
http://stephen.evanchik.com

Mime
View raw message