Spring和Controller之间的关系是什么

时间:2018-01-12 17:46:47

标签: spring tomcat spring-boot apr

我有一个控制器正在做某事,一切似乎都很好,它记录成功,然后它就这样做

return new ResponseEntity<>(resp, HttpStatus.OK);

好像它应该发送200 OK。

好吧,我还有一个带有“afterCompletion”的HandlerInterceptorAdapter来记录状态:

logger.debug("Response status: {}, URI: {}", response.getStatus(), request.getRequestURI());

这显示了控制器取得成功的500。

在stdout日志中我看到错误

2018-01-12 12:33:59.035 ERROR 18952 --- [pr-8080-exec-14] o.s.boot.web.support.ErrorPageFilter     : Cannot forward to error page for request [/ws/path] as the response has already been committed.
As a result, the response may have the wrong status code. If your application is running on WebSphere Application Server you may be able to resolve this problem by setting com.ibm.ws.webcontainer.invokeFlushAfterService to false

org.apache.catalina.connector.ClientAbortException: java.io.IOException: APR error: -32

我找不到任何关于APR错误的文档,我不知道为什么状态代码会出错。我正在使用tomcat 8.5。

1 个答案:

答案 0 :(得分:0)

因此。 APR -32是&#34;客户端中止&#34;错误。客户在等待时间超时。看起来发生的事情是客户提出请求并且排队等候几秒钟。它有一个短的硬超时限制。客户端在服务器到达请求之前超时。然后服务器接收了请求并做了一切正常但是当尝试写回客户端时,它发现套接字已关闭。所以它设置了500并抛出了异常。