jettycontinuationsjakarta-migrationjetty-12

What is the equivalent of the code written by jetty.continuation in Jakarta.server.AsyncContext?


I want to upgrade my project from jetty 9 to 12. Since the jetty.continuation is deprecated, I want to replace the following code snippet using AsyncContext class.

        Continuation cont = ContinuationSupport.getContinuation(request);
         .
         .
         .
        cont.setTimeout(suspendMs);
        cont.suspend();

what is the code equivalent?

which method does implement "suspend" in AsyncContext class?


Solution

  • The best source of advice for moving from Jetty Continuations (deprecated in Jetty 8 btw, removed in Jetty 10), is to look at the Servlet3Continuations.java source in the jetty-9.4.x branch.

    Methods like suspend() and resume() are not a 1::1 method call on AsyncContext, but in fact multiple method calls.

    Continuation to AsyncContext