I'm troubleshooting a Java app where XML is sent between two systems using HTTP POST and Servlet. I suspect that the problem is that the XML is growing way too big. Is it possible that this is the problem? Is there a limit?
When it doesn't work, the request.getParameter("message")
on the consumer side will return null. Both apps are running on TomCat. For instance, an XML document of size 1.73mb will not make it through.
The default value of the HTTP and HTTPS connector maximum post size is 2MB. However you can adjust the value as per your requirement. The below command to set the connector to accept maximum 100,000 bytes. If the http request POST size exceeds the 100,000 bytes then connector return HTTP/1.1 400 Bad Request.
Internet Explorer also has a maximum path length of 2,048 characters. This limit applies to both POST request and GET request URLs. 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.
The POST data length is the entire length of the POST data payload. Query string length violation. A query string length violation occurs when the incoming request contains a query string that exceeds the acceptable length defined in the security policy.
By default Tomcat limits POST data to 2 MB. This limit can cause an issue when you use rule sets, which can post data greater than this limit. To disable the POST limit in Tomcat, you can add the maxPostSize="-1" attribute to the <Connector> element of the server. xml configuration file.
As per this the default is 2 MB for your <Connector>
.
maxPostSize = The maximum size in bytes of the POST which will be handled by the container FORM URL parameter parsing. The limit can be disabled by setting this attribute to a value less than or equal to 0. If not specified, this attribute is set to 2097152 (2 megabytes).
Edit Tomcat's server.xml. In the <Connector>
element, add an attribute maxPostSize
and set a larger value (in bytes) to increase the limit.
Having said that, if this is the issue, you should have got an exception on the lines of
Post data too big
in tomcat
For Further Info
There is no defined maximum size for HTTP POST requests. If you notice such a limit then it's an arbitrary limitation of your HTTP Server/Client.
You might get a better answer if you tell how big the XML is.
There may be a limit depending on server and/or application configuration. For Example, check
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With