我有一个Spring Boot API,我想在客户端关闭连接时检测并处理该事件(同时仍具有请求和响应内容的上下文)。
我进行了一些调查,发现关闭客户端连接时会抛出以下异常:
2019-09-06 09:51:12.794 DEBUG 28740 --- [nio-8080-exec-1] o.apache.coyote.http11.Http11Processor : Error parsing HTTP request header
java.io.IOException: An established connection was aborted by the software in your host machine
at sun.nio.ch.SocketDispatcher.read0(Native Method) ~[na:1.8.0_112]
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43) ~[na:1.8.0_112]
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) ~[na:1.8.0_112]
at sun.nio.ch.IOUtil.read(IOUtil.java:197) ~[na:1.8.0_112]
我在网上发现的唯一结果是,此异常是信息性的,可以忽略(在大多数情况下都是如此)。有没有办法在Spring Boot中拦截和处理此异常?