A requestmapping made with this tool would work as follows:
In @RequestMapping, do initial parameter validation, e.g. auth/authz, sanity checking of params.
Fire off, using the tool, a Mats flow using a modified version of the SynchronousAdapter logic. The tool would close over the async-context in the ".then()"-lambda on the CompletableFuture.
Exit @RequestMapping
When Mats returned and .completed() the CompletableFuture, the tool would take over again. I am not certain how the async-context works, but if the sending of the finished content possibly can block on network traffic (i.e. one goes back to synchronous processing regarding the output stream to the client browser), the finishing would have to be handed over to a new thread pool, of comparable size to the Servlet container's thread pool.
A requestmapping made with this tool would work as follows: