javax. servlet. HttpServletRequest. Getcontentlength() returns only int
•
Java
In order to handle the large request body in HTTP post or put, it depends on HttpServletRequest Getcontentlength () is not a good idea because it returns only integer values or - 1 for the request body > 2GB.
However, I have no reason why a larger requesting body should not be allowed RFC 2616 says
Use HttpServletRequest Getheader ('content length ') and resolve it to long. Is it valid?
Solution
Yes, this is a good method – use getheader ("content length") (case) and long parseLong(..). I believe this is what the container is doing, but it is limited to int by Serlvet specification
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码