java.lang.IllegalStateException: getReader() has already been called for this request
时间: 2023-11-07 09:35:47 浏览: 332
Java异常之—-Caused by: java.lang.IllegalStateException: Method has too many Body parameters
This exception is thrown when you try to call the getReader() method on an HttpServletRequest object after it has already been called for the same request.
The getReader() method returns a BufferedReader object that can be used to read the request body as a character stream. Once this method has been called, the request body has already been read and processed, and calling the method again will result in an IllegalStateException.
To avoid this exception, make sure to call the getReader() method only once for each request, and store the returned BufferedReader object in a variable if you need to use it multiple times. Alternatively, you can use the getInputStream() method to read the request body as a byte stream, which can be read multiple times without issue.
阅读全文