Bugfix: IllegalStateException

java.lang.IllegalStateException: getWriter() has already been called for this response

Error while executing this code:

OutputStream out = response.getOutputStream();


By searching for data analysis, Response.getWriter() has already been opened, so an error will be reported when getting getOutputStream again. because

getWriter() and getOutputStream() cannot be called simultaneously in the same response.

When I see usingWriter=true in the response, I immediately find a way to set the flag to false.

response.reset(); That's it, note that the cache disappears after reset.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324814086&siteId=291194637