Hi Chris, Thanks for the reminder. following is the code that runs the timeout listener on time while running on http1.1 but not on http2. tested on 9.0.29 //// start code@WebServlet(name = "Test", urlPatterns = {"/test"}, asyncSupported = true)public class Main extends HttpServlet { @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); final AsyncContext ac = request.startAsync(); ac.addListener(new AsyncListener() { @Override public void onComplete(AsyncEvent event) throws IOException { System.out.println("AppAsyncListener onComplete"); } @Override public void onTimeout(AsyncEvent event) throws IOException { System.out.println("AppAsyncListener onTimeout"); AsyncContext ac = event.getAsyncContext(); ac.complete(); } @Override public void onError(AsyncEvent event) throws IOException { System.out.println("AppAsyncListener onError"); } @Override public void onStartAsync(AsyncEvent event) throws IOException { System.out.println("AppAsyncListener onStart"); } }); ac.setTimeout(2000); ac.start(new Runnable() { @Override public void run() { try (PrintWriter out = ac.getResponse().getWriter()) { for (int i = 0; i < 10; i++) { try { String text = "Counter :" + i + "\n"; out.write(text); out.flush(); Thread.sleep(500); } catch (InterruptedException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } ac.complete(); } catch (IOException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } }); } }//// end code server.xml excerpt for http2 is : <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" overheadContinuationThreshold="0" overheadDataThreshold="0" overheadWindowUpdateThreshold="0" /> Thanks and Cheers On Thursday, December 5, 2019, 11:14:46 PM GMT+7, Christopher Schultz <ch...@christopherschultz.net> wrote: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
Afief, On 12/5/19 00:47, Arief Hasani wrote: > Seems like AsyncContext.setTimeout is not working if using http2 > (clients are chome, firefox, safari on mac). It runs well on > http1.1 Seems like posting some sample code with your expectations and observed results might be helpful here. - -chris -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl3pLOcACgkQHPApP6U8 pFgaxA/+KjciXsMo/L26sFneXMCTNu/jxxlRaY4h1YnJW7kd2K/e5yu9q7uVJHwA fUk7K1/ftZF+h/SPxVJRl9uZPSRNUd6NyANHGHtO++jPdhZQJKaqXl79fdvCBX4/ 9KO5CyUrp3+I088bXaKdiBWmNoUXoOPysMuWNQyVR90IXDYDnbpAJO8U/IKQT/us VVFfGu3vA+mpcRndYmywSlXzP/D7bwcTEuaHqXFuewJ+HxASLbgTwW1bmHdncHkS 7NGNV/A3i2RF5MJCcmG3Y2ovDPNb4xhjhriazyQ44sX3PZZimRRaGRcg9vrodFww QlvtWaitPNmLBtegGbTUoFLy5OjVq1mLZVfpIQ4/t/7WQdhBDCndg8eSfF8Ucrpq 9I8D1E5sggLOmUFEmFnNVcQNQ34Rk4/Rg59SwaoXyT8cJBEYLDg8NViA6zqDGFXF dTGEEI/ljO6lAqp3vsCoVV5ri+dGXEaYDlCGvsFMt9cHPAnsFOoN2DP+EIFwixKT LoF5EGxa6mDHN+gs57G1OU+8E62AwKU+Z5ySrvs0ibV00in3GMacB+ls39fZbzqx CTcsnbwQj1k9covq18UTj0Lw7Ni/DyxjE+FWvCKPBxYuIpob8KMyBRU2snYVIN+5 LwVk3sxs6TMAPqClB+aga9O9e3728G5vpEacF5CoyrIRNZO2YF4= =mYUh -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org