We cannot ship without ensuring that all requests in a single tick of the event loop reach the server in a single http request. The simple DynaTableRF sample is already locking up the browser.
This should be as simple as
- find the spot where we fire requests and instead putting them in a string buffer / json object
- issue a ScheduleFinally to do the actual fire
- have the server fire off each request and capture its response string
- append these and return them to the client in a single response
- have the client resolve each response
- Create a subclass of DefaultRequestTransport that adds wire-level coalescing.
- It may be simpler code-wise to add a "protected boolean enableCoalescing()" to DRT and only override the one method in the subclass.
- Change RequestFactoryJsonImpl.initialize(EventBus) to use a GWT.create(RequestTransport.class)
- Add <replace-with> rebind rules for RequestTransport in RequestFactory.gwt.xml.
- One should use DefaultReqestTransport, the second should use the coalescing variant.
- Introduce a deferred-binding variable to control whether or not coalescing is used.
- Update the RequestFactoryServlet to look for a coalesced request (based on header?) and move the code that calls JsonRequestProcessor into a loop that has robust exception handling.
- The same code should be able to handle a standalone request as easily as a coalesced request.
- Thinking about it more, I'm not really fond of using a co-servlet that uses RequestDispatchers.
- Pack the payloads into a coalesced response, and have the CoalescingRequestTransport demux the payload.
With this approach, you shouldn't need to touch any of the RequestFactory guts.