Getting Started with Reverse Ajax

To use Reverse Ajax in passive mode (piggyback only) no configuration is required. To enable active Reverse Ajax, 2 configuration steps are needed.

The first step is to allow active Reverse Ajax from the server. This is a server configuration for security reasons. All that is needed is a few of lines in your WEB-INF/web.xml:

<servlet>
  <servlet-name>dwr-invoker</servlet-name>
  <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
  <init-param>
    <param-name>activeReverseAjaxEnabled</param-name>
    <param-value>true</param-value>
  </init-param>
  ...
</servlet>

The second step is to request active Reverse Ajax in a web page. This begins a Comet/polling cycle. Just call the following as part of the page load event:

dwr.engine.setActiveReverseAjax(true);

There are further configuration options, to allow finer control of connection times, and to manage proxy interactions.