users@jersey.java.net

Re: [Jersey] jersey client and large file uploads

From: Igor Minar <iiminar_at_gmail.com>
Date: Thu, 13 Aug 2009 12:04:10 -0700

On Aug 12, 2009, at 11:45 PM, Paul Sandoz wrote:

> Hi Igor,
>
> If Jersey knows the size in advance the size then it will do:
>
> if (size != -1 && size < Integer.MAX_VALUE) {
> // HttpURLConnection uses the int type for
> content length
> uc.setFixedLengthStreamingMode((int)size);
>
> Note the restriction in size. So if you POST or PUT an instance of
> File whose size is less than Integer.MAX_VALUE this should work. Is
> it not working for you?

and where does "size" come from? I think this is the issue, since we
set the content length header manually and it probably doesn't get
registered in the web resource builder.

the code above also means that we won't be able to send files larger
than ~2GB due to int overflow.

thanks,
Igor

>
> In fact there is an issue with setting this because retry will not
> work for authentication. So i think we require a property to ensure
> that this is enabled or not.
>
> Paul.
>
> On Aug 13, 2009, at 7:41 AM, Igor Minar wrote:
>
>> hi there,
>>
>> we noticed that if I try to upload large files via jersey client
>> (by passing a input stream to the client), the jvm will run out
>> memory unless we use chunked encoding.
>>
>> Isn't there a way to avoid chunked encoding (which just adds
>> overhead in case of static content)?
>>
>> thanks,
>> Igor
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>