This page is part of a set of pages aimed at DWR developers. If this isn't you, then you probably want the documentation index.
With Grizzy, Jetty and Servlet spec containers the process normally starts off with DwrServlet (org.directwebremoting.servlet.DwrServlet) which simply passes the request to the configured UrlProcessor (org.directwebremoting.servlet.UrlProcessor). This allows other start points (e.g. the Spring based DwrController / DwrSpringServlet or Rife's DWR integration) to pass control to the same place simply.
UrlProcessor is just a list of Handlers (org.directwebremoting.extend.Handler) each of which is essentially a Servlet. It's done this way so that the user only has to configure DwrServlet (although it's possible to reconfigure the Handlers internally)
In the case of a reverse ajax, the request maps to a PollHandler (org.directwebremoting.dwrp.PollHandler) or specifically an HtmlPollHandler or a PlainPollHandler depending on if the request came from a source that expects HTML (i.e iframe or htmlfile) or simple JavaScript (i.e. XHR). The real work for both is done by PollHandler.handle. The following notes may help, however PollHandler.handle is well documented.
A key interface for any special integration with a new container is the Sleeper interface (org.directwebremoting.extend.Sleeper). This enables DWR to send a thread to sleep and to wake it up again. PollHandler will get its Sleeper from the implementation of ContainerAbstraction (org.directwebremoting.extend.ContainerAbstraction). In theory the only integration needed between DWR and some new async capable container is to pass requests to the UrlProcessor and to have an implementation of ContainerAbstraction.
There are also a set of Alarms (org.directwebremoting.extend.Alarm). The PollHandler configures a set of Alarms, and configures them to awake the Sleeper.
The following things happen when DWR sends out a reverse ajax poll: