tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Problem with POST to servlet: 16384 bytes maximum?
Date Fri, 08 Aug 2008 15:27:50 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michele,

Michele Fuortes wrote:
| I tried 5.5.26 and 5.5.17 and it changed (for the worse-;).
| The file now gets messed up at 7620 bytes

At least the application runs faster, now ;)

Seriously, though, we use TC 5.5.23 in our demo environment and we
routinely POST files bigger than 16k. I just checked, and the most
recent was 37952 bytes.

Can you post your entire servlet's code? Looking at the snippet, it
looks like your code should work. But, I've never seen anyone write an
upload servlet like the one you have shown (reading the POST in one big
chunk). I usually see them using a smaller buffer to read all the
content, like this:

BufferedInputStream in = request.getInputStream();
OutputStream out = ...;
byte[] buffer = new byte[BUFFER_SIZE];
int read;
while(-1 != (read = in.read(buffer)))
~   out.write(buffer, 0, read);
out.flush();
out.close();

This will allow you to read larger POST data without worrying about
memory consumption, too, which is nice.

Hope that helps,
- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkicZfYACgkQ9CaO5/Lv0PCLJwCfcxG0Yvl2fGqsGPzGcZ6lCCCT
yR8An16qNPZ8oeGDA+FYmAcQBe0Iagwe
=nWQg
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message