I am sending ~10MB data to Tomcat through PUT call. I have increased POST size allowed on Tomcat. However, in the middle of sending that data, my Spring Security returns an authorization error (which is a valid error as per application logic). The client does not notice this and keeps sending data to the server which eventually resets the connection. My question is whether some setting in Tomcat by default starts 'streaming' data to controller servlet as soon as the client starts sending request? Else, what makes it not wait for full data before sending response?
In PUT, the data is part of the URL. In POST, the data is in the request body. Most notably, there's an upper limit on how big a URL can be, although it's not predictable. At one time, it was as small as 2K.
Unless you "chunk" your request, the standard for HTTP is to push the entire POST request to the server before the application can handle it. At the server (Tomcat) level, a data limit or (apparently early processing of the URL part of the request) can cause Tomcat to shut down the receiving socket request. I've never looked at the details, since it's never been important to me.
From what I've seen, the net effect of a long POST request is that Tomcat stores everything either in RAM or an unknown temporary file until the entire (unchunked) POST is received and only then is the request dispatched to the webapp, which can then use J2EE API calls to pull the long data from whatever secret storage it's in and put it someplace where the webapp can work with it.
Actually, a quick check to refresh my memory and it looks like HTTP chunking is only for responses, not requests. So you may not have that option directly. There are ways to chunk manually using AJAX on the client, though. It's how the web controls that show upload progress work. Normally an upload goes straight from 0% to 100% with nothing in between, but AJAX chunking code can break up the data and in the process, update the client GUI.
"privilege" comes from the Latin words for "private" and "law" (legal) and dates to feudal times. To "claim privilege" meant that you were above the laws that applied to the common people.