title: How to handle client abort during request upload?
body: <p>Given the following application, based on a <a href="https://start.spring.io" rel="nofollow noreferrer">Spring Initializr</a> template</p>
  <pre class="lang-java prettyprint-override"><code>@SpringBootApplication
  public class DemoApplication {
      public static void main(String[] args) {
          SpringApplication.run(DemoApplication.class, args);
      }
  
      public static class Payload {
          public String field1;
          public String field2;
      }
  
      @RestController
      public static class MyController {
          @RequestMapping(&quot;/echo&quot;)
          public ResponseEntity&lt;Payload&gt; echo(@RequestBody Payload payload) {
              return new ResponseEntity&lt;&gt;(payload, HttpStatus.OK);
          }
      }
  }
  </code></pre>
  <p>If I abort the connection after sending the headers</p>
  <pre class="lang-none prettyprint-override"><code>$ nc 192.168.56.1 8080
  POST /echo HTTP/1.1
  Host: 192.168.56.1:8080
  Content-Type: application/json
  Content-Length: 42
  
  ^C
  </code></pre>
  <p>Then the server attempts to respond with a 400 and the following is logged</p>
  <pre class="lang-none prettyprint-override"><code>2016-05-03 16:56:28.916  WARN 5776 --- [nio-8080-exec-2] .w.s.m.s.DefaultHandlerExceptionResolver : Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: Unexpected EOF read on the socket; nested exception is java.io.EOFException: Unexpected EOF read on the socket
  2016-05-03 16:56:28.997 ERROR 5776 --- [nio-8080-exec-2] o.a.c.c.C.[Tomcat].[localhost]           : Exception Processing ErrorPage[errorCode=0, location=/error] org.apache.catalina.connector.ClientAbortException: java.io.IOException: An established connection was aborted by the software in your host machine
  </code></pre>
  <p>If instead the client aborts after the request has been sent, nothing is logged by default and the resulting <code>ClientAbortException</code> is available in filters via <code>ErrorAttributes#getError</code>.</p>
  <p>How can I handle the during-request abort in the same way? That is, not having any warn/error logged by default, and to enable custom filters to tell that the client has aborted.</p>