You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by Philippe Chantry <ph...@inp-toulouse.fr> on 2016/04/27 13:16:35 UTC

512k limit ?

Hi all,

I'm trying to upload files to an ECM with a multipart POST HTTP request 
using HttpURLConnection.

It works fine if the file size is less than or equal to 524288 bytes (= 
512k), and fails if the file is larger.

Is 512k an inner limitation of groovy for a POST parameter size ? Is 
there some workarounds ?

(The same program written in pure java has not this limitation problem.)

Thank you,
Philippe

Re: 512k limit ?

Posted by "Edinson E. Padrón Urdaneta" <ed...@gmail.com>.
My pleasure. Glad to be of help! Take care.​

Re: 512k limit ?

Posted by Philippe Chantry <ph...@inp-toulouse.fr>.
Hi Edinson,

Indeed, it was not a Groovy problem !

Thanks for your answer.

Philippe


Le 27/04/2016 � 14:03, Edinson E. Padr�n Urdaneta a �crit :
> Hi there,
>
> It should be notice that `HttpURLConnection` comes from Java and not 
> from Groovy.
>
> After a quick Google search I got:
>
> "HttpURLConnection does support the POST method, try 
> setRequestMethod("POST"). Also persistent connections are supported. 
> Note that the connection is only re-used after you have read the 
> response body. In the code example you posted it doesn't look like you 
> are reading the response. Since jdk6 the HTTP protocol handler will 
> attempt to read-ahead to make the connection available for re-use. It 
> reads to up ~512k so if the HTTP server returns megabytes of data and 
> you aren't reading it then the connection will be closed and not 
> re-used." [1]
>
> "|HttpURLConnection| 
> <http://download.oracle.com/javase/6/docs/api/java/net/HttpURLConnection.html> 
> *will* reuse connections if it can 
> <http://download.oracle.com/javase/6/docs/technotes/guides/net/http-keepalive.html>! 
>
>
> For this to work, several preconditions need to be fulfilled, mostly 
> on the server side. Those preconditions are described in the article 
> linked to above." [2]
>
> [1] https://community.oracle.com/thread/1147187?start=0&tstart=0
> [2] http://stackoverflow.com/a/5459200
>
> Hope it helps. And remember, Google is your friend.
>
>
> On Wed, Apr 27, 2016 at 6:46 AM, Philippe Chantry 
> <philippe.chantry@inp-toulouse.fr 
> <ma...@inp-toulouse.fr>> wrote:
>
>     Hi all,
>
>     I'm trying to upload files to an ECM with a multipart POST HTTP
>     request using HttpURLConnection.
>
>     It works fine if the file size is less than or equal to 524288
>     bytes (= 512k), and fails if the file is larger.
>
>     Is 512k an inner limitation of groovy for a POST parameter size ?
>     Is there some workarounds ?
>
>     (The same program written in pure java has not this limitation
>     problem.)
>
>     Thank you,
>     Philippe
>
>

-- 
*Philippe Chantry*
Ing�nieur de d�veloppement
logo INP
	
T�l : +33 (0)5 34 32 30 83
INSTITUT NATIONAL POLYTECHNIQUE DE TOULOUSE
6 all�e Emile Monso - BP 34038 - 31029 Toulouse cedex 4


Re: 512k limit ?

Posted by "Edinson E. Padrón Urdaneta" <ed...@gmail.com>.
Hi there,

It should be notice that `HttpURLConnection` comes from Java and not from
Groovy.

After a quick Google search I got:

"HttpURLConnection does support the POST method, try
setRequestMethod("POST"). Also persistent connections are supported. Note
that the connection is only re-used after you have read the response body.
In the code example you posted it doesn't look like you are reading the
response. Since jdk6 the HTTP protocol handler will attempt to read-ahead
to make the connection available for re-use. It reads to up ~512k so if the
HTTP server returns megabytes of data and you aren't reading it then the
connection will be closed and not re-used." [1]

"HttpURLConnection
<http://download.oracle.com/javase/6/docs/api/java/net/HttpURLConnection.html>
*will* reuse connections if it can
<http://download.oracle.com/javase/6/docs/technotes/guides/net/http-keepalive.html>
!

For this to work, several preconditions need to be fulfilled, mostly on the
server side. Those preconditions are described in the article linked to
above." [2]
[1] https://community.oracle.com/thread/1147187?start=0&tstart=0
[2] http://stackoverflow.com/a/5459200

Hope it helps. And remember, Google is your friend.


On Wed, Apr 27, 2016 at 6:46 AM, Philippe Chantry <
philippe.chantry@inp-toulouse.fr> wrote:

> Hi all,
>
> I'm trying to upload files to an ECM with a multipart POST HTTP request
> using HttpURLConnection.
>
> It works fine if the file size is less than or equal to 524288 bytes (=
> 512k), and fails if the file is larger.
>
> Is 512k an inner limitation of groovy for a POST parameter size ? Is there
> some workarounds ?
>
> (The same program written in pure java has not this limitation problem.)
>
> Thank you,
> Philippe
>