users@jersey.java.net

[Jersey] Re: Jersey 2 Client that would write the stream of data to POST call chunk by chunk

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Mon, 15 Aug 2016 13:37:13 +0200

Hi Naseer,

have you seen this test?

https://github.com/jersey/jersey/blob/2.x/tests/e2e/src/test/java/org/glassfish/jersey/tests/e2e/client/ClientBufferingDisabledTest.java

Regards,
Pavel


On 15/08/16 12:53, Naseer Sargi wrote:
>
> I wanted to write a Jersey 2 Client that would write the stream of
> data to POST call chunk by chunk.
>
> Why? , this will help me to avoid to keep the whole inputstream
> request data to store in disk memory before sending via a POST call.
>
> I have searched over the net and looked into Jersey2 API as well but
> did not find any solution , however there are solution for server side
> which sends the huge response in stream and reads the same in Jersey
> Client by doing a GET call at Client , but I wanted send the huge
> payload say 1 GB of XML data as stream vis POST call.
>
> I tried using solution given in here
> <http://stackoverflow.com/questions/10326460/how-to-avoid-outofmemoryerror-when-uploading-a-large-file-using-jersey-client> ,
> but this solution again uses the system memory.
>
> I do not want to store 1GB of data in disk , instead create on-fly the
> 1GB request stream of data / write the 1GB data to POST call directly
> chunk by chunk.
>
> Any help highly appreciated. Thanks in Advance.
>