On 12/08/2020 17:50, Suraj Puvvada wrote: > 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().
ServletRequest.startAsync() uses the original, unwrapped request and response. You need to use ServletRequest.startAsync(ServletRequest,ServletResponse) Mark --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org