File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes maximum allowable length when POST used Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "maximum allowable length when POST used" Watch "maximum allowable length when POST used" New topic

maximum allowable length when POST used

vikram bollu

Joined: Sep 07, 2009
Posts: 9
what is the maximum allowable length for a hidden field if the form method is POST?
jatan bhavsar
Ranch Hand

Joined: Jul 23, 2008
Posts: 297

Hi Vikram ,

If there is post method then there isnt any max limit for request parameter including hidden ,but some contianer or server set the maxpost size like tomcat does in server.xml , and if get is used there is limit of 255 characters only.

vikram bollu

Joined: Sep 07, 2009
Posts: 9

Thanks for your reply, I know about the GET. But when I am trying with POST with huge data it is giving OutofMemory exception so I used session.
I am using weblogic. So, do you think we can set max size for POST at server side (any server like tomcat as you said), if yes could you tell me how to set for weblogic
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

The actual limit on the total size of a POST is essentially unlimited. After all, a POST can contain multiple large file uploads.

However, file uploads are intercepted and (usually) spooled to a temporary disk file. Form values, on the other hand, are more likely to result in direct in-memory object creation. A String, in this particular case.

You'd get an out-of-memory exception in the event that the size of the resulting string - or the sum total of the sizes of the intermediate objects at any point in the processing - exceeds available free memory. You'd probably get something like an Array Index Bounds Exception if the input had simply exceeded some internal structure size.

So, in theory, you could just use the "IBM" solution (Install Bigger Memory). In practice, however, if you're transmitting data that's that large, you're really putting pressure on performance. The more data, the longer it takes to transmit it, and the bigger the load on the network. And that's not even counting the possibility that you could blow out memory on the client side, where you have no control over how much memory is allocated.

And, if that isn't enough incentive, the more data you send that way, the more likely you're sending sensitive information. A well-designed webapp keeps as much of the sensitive data on the server as it can, since once data gets on the open Internet and into clients, it can be intercepted, decrypted (hopefully it WAS encrypted), and even modified.

An IDE is no substitute for an Intelligent Developer.
Jayesh A Lalwani
Saloon Keeper

Joined: Jan 17, 2008
Posts: 2744

How big is your form? I've never seen a form so big that it causes the server to go OOM. Not saying it can't happen. Just that it's very unlikely.

Most likely, you are using up memory while processing the big form. It may not be the form that is the problem, but the design of the servlet/action that handles the form that may be the problem. Have you determined that the servlet/action is not the problem?
I agree. Here's the link:
subject: maximum allowable length when POST used
It's not a secret anymore!