Server exception: java.lang.IllegalStateException

Error message:

    java.lang.IllegalStateException: Cannot call sendError() after the response has been committed

    Use select to build a write interface, the returned data is in json format, and the data is written out to the browser directly using the stream. The data is written normally, but the server console consistently reports abnormal information, which is very uncomfortable to look at. I checked the reason. For this reason, the SSH framework will also occur, and the problem lies in select (or Struts2);

    The server does not allow multiple requests. After the corresponding end of the request again, the socket expires, and operations are not allowed. When the json data is written out to the page with a stream, it marks the end of this request and response. , so the server will report an error if it continues to run down;

    So just return after returning the json stream to solve the problem;

@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String dispose = request.getParameter("page");
if ("index".equals(dispose)) {
this.toIndex(request,response);return;

}

        }

ohhh!

Guess you like

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