1

I am creating a string variable in javascript and the length of that string could be any.

I am sending this string by jquery post method to a servlet. This servlet writes the string to a file.

I can alert the string anywhere in my javascript and can see the complete string.

But whenever the string length exceeds 5345 characters, then I get "aborted" message in firebug (I assume data is not sent) and no error message is displayed in server's console. (For chrome, length limit is little more i.e. 5389)

I guess there is a problem in length of the data that is being sent to the servlet. But I wonder, to my knowledge there is no limit to the amount of data sent by post.

I am using jquery's $.post method as below

$.post('servlet', function(data) {

});

I want to print the error that has occurred while sending data to the servlet. Can I do that?

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
Ashwin
  • 12,081
  • 22
  • 83
  • 117
  • 2
    Take a look at this question, it might help: http://stackoverflow.com/questions/2364840/what-is-the-size-limit-of-a-post-request – Abbas Jan 03 '12 at 14:15
  • 2
    I believe that a limit (if there is one) would be based on the particular application server. What app server are you using? Tomcat? WebLogic? For Tomcat, there is a maxPostSize attribute - http://tomcat.apache.org/tomcat-5.5-doc/config/http.html – Zack Macomber Jan 03 '12 at 14:19
  • I am using jboss server. With help provided from *Abbas* I came to know that there is maxPostsize attribute to be set at jboss. But don't know exactly in which file. Can you help? – Ashwin Jan 03 '12 at 14:29
  • @Abbas and ZackMacomber are most likely spot on, but out of curiosity, what's causing the difference between browsers? Different length in the headers? – nikc.org Jan 03 '12 at 15:17

1 Answers1

1

If you are using the GET method, you are limited to a maximum of 2,048 characters, minus the number of characters in the actual path.

However, the POST method is not limited by the size of the URL for submitting name/value pairs. These pairs are transferred in the request body and not in the URL.

Matt Enright
  • 7,245
  • 4
  • 33
  • 32
Mehul Hingu
  • 1,240
  • 1
  • 9
  • 12