更新时间:2023-12-04 14:24:02
简单回答:
使用 getReader() 读取请求正文
Simple answer:
Use getReader() to read the body of the request
更多信息:
读取body中的数据有两种方法:
More info:
There are two methods for reading the data in the body:
getReader()
返回一个 BufferedReader 这将允许您读取请求的正文.
getReader()
returns a BufferedReader that will allow you to read the body of the request.
getInputStream()
返回一个 ServletInputStream 如果您需要读取二进制数据.
getInputStream()
returns a ServletInputStream if you need to read binary data.
文档中的注释:可以调用[任一方法] 来读取正文,而不是同时调用."
Note from the docs: "[Either method] may be called to read the body, not both."