//可以使用 ServletInputStream
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
int contentLength = req.getContentLength();
byte[] buffer = new byte[contentLength];
ServletInputStream in = null;
try {
in = req.getInputStream();
in.read(buffer, 0, contentLength);
in.close();
String bodyData = new String(buffer, StandardCharsets.UTF_8);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (null != in) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}