I'm trying to capture the request and response body for async servlets. Currently I'm using a filter to wrap the request and response via the HttpServletRequestWrapper and HttpServletResponseWrapper and wrap the InputStream and OutputStream objects and copy the data whenever read or write calls are invoked.
This works fine for regular synchronous servlet calls. However for async servlets I noticed that the wrapper classes are unwrapped and associated with the AsyncContext so I no longer am able to capture the data. This is in Tomcat 8.x. The API to start async processing used is request.startAsync().