users@jersey.java.net

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

From: Naseer Sargi <naseer.sargi_at_gmail.com>
Date: Mon, 15 Aug 2016 16:23:52 +0530

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.