@Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {
      if (req.isAsyncSupported()) {
        resp.getWriter().print("TimeoutServletGet-");
        final AsyncContext ac = req.startAsync();
        ac.setTimeout(3000);

        ac.addListener(new TrackingListener(false, completeOnTimeout, dispatchUrl));
      } else resp.getWriter().print("FAIL: Async unsupported");
    }
 @Override
 protected void service(HttpServletRequest req, HttpServletResponse resp)
     throws ServletException, IOException {
   if (req.isAsyncStarted()) {
     req.getAsyncContext().complete();
   } else if (req.isAsyncSupported()) {
     AsyncContext actx = req.startAsync();
     actx.addListener(this);
     resp.setContentType("text/plain");
     clients.add(actx);
     if (clientcount.incrementAndGet() == 1) {
       ticker.addTickListener(this);
     }
   } else {
     new Exception("Async Not Supported").printStackTrace();
     resp.sendError(400, "Async is not supported.");
   }
 }
Exemplo n.º 3
0
 @Override
 public boolean isAsyncSupported() {
   return request.isAsyncSupported();
 }