In http request, there are differences between header and Body. Use request.getHeader("...");
Reading Body uses request.getReader(), but getReader gets the BufferedReader, which needs to be converted into a string.
Here is the conversion method.
public static String getBodyString(BufferedReader br) { String inputLine; String str = ""; try { while ((inputLine = br.readLine()) != null) { str += inputLine; } br.close(); } catch (IOException e) { System.out.println("IOException: " + e); } return str; }The above is the entire content of the Java code for reading the body instance in http requests brought to you by the editor. I hope it will be helpful to everyone and support Wulin.com more~