groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edinson E. PadrĂ³n Urdaneta <edinson.padron.urdan...@gmail.com>
Subject Re: 512k limit ?
Date Wed, 27 Apr 2016 12:03:08 GMT
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
>

Mime
View raw message