Re: Returning CompletionStage from the resource method


 

Won't that work what I proposed in the issue tracker:

Giving it a second thought I wonder whether Servlet's AsyncContext wouldn't provide what I proposed originally: A handle to the "original" executor (not in the sense of Executor class, but in the sense of separation of concerns).

The servlet could invoke JAX-RS using request.startAsync().start(r), where r first invokes JAX-RS, gets the resulting CompletionStage, and adds to that whenComplete((o,e) ->

{...; asyncContext.complete()}

);

I assume that AsyncContext.complete() will in turn send the HttpServletResponse using the Servlet's own thread pool.

Join jaxrs-spec@javaee.groups.io to automatically receive all group messages.