Primary links
Search the Site:

Tomcat 6.0 comet support and asynchronous servlets

Comet support allows a servlet to process IO asynchronously, recieving events when data is available for reading on the connection , and writing data back on connections asynchronously.

Comet applications can deliver data to the client at any time, not only in response to user input. The data is delivered over a single, previously-opened connection. This approach reduces the latency for data delivery significantly.

Tomcat 6.0 comet support

  • CometEvent
  • Servlets which implement the org.apache.catalina.CometProcessor interface will have their event method invoked rather than the usual service method, according to the event which occurred.

    • EventType.BEGIN: will be called at the beginning of the processing of the connection.
    • EventType.READ: This indicates that input data is available, and that one read can be made without blocking.
    • EventType.END: End may be called to end the processing of the request.
    • EventType.ERROR: Error will be called by the container in the case where an IO exception or a similar unrecoverable error occurs on the connection.
  • CometFilter
  • Similar to regular filters, a filter chain is invoked when comet events are processed. These filters should implement the CometFilter interface

  • Resources
  • Advanced IO and Tomcat
    Comet: Low Latency Data for the Browser
    Apache Tomcat Comet API Wiki
    Developing Applications Using Reverse Ajax : DWR