In order to deal with a large request body in a HTTP POST or PUT, relying on HttpServletRequest.getContentLength()
is not a good idea, since it returns only integer values, or -1 for request bodies > 2GB.
However, I see no reason, why larger request bodies should not be allowed. RFC 2616 says
Any Content-Length greater than or equal to zero is a valid value.
Is it valid to use HttpServletRequest.getHeader('content-length')
and parse it to Long instead?