1 Reply Latest reply on Aug 13, 2008 9:00 AM by Remy Maucherat

    CometEvent WRITE/resume() interface

    null null Newbie

      Hi
      I'm a bit baffled with the WRITE semantic in CometEvent.
      Does the resume() semantic imply that the servlet should keep a reference to the last comet event handled and call resume on it ?
      I.e, in pseudo-code:

      void event(CometEvent e) {
      ...
      case READ:
      if (all request is read) {
      e.suspend();
      doAsync(e);
      }
      case EVENT:
      // resume was called: write on reponse
      while (e.ready()) {
      e.getHttpResponse().getWriter().print(some buffer);
      }
      case WRITE:
      // Continue with writing
      e.getHttpResponse().getWriter().print(some other buffer);
      }

      void doAsync(final CometEvent e) {
      (new Thread() { public void run() {
      ...do something...
      e.resume();
      }}.start();
      }

      Anyone can confirm ?

      /zog