Wednesday, March 31, 2010

Asynchronous Request Dispatcher Quick Start Guide

This is a quick guide to get started with the IBM Asynchronous Request Dispatcher (ARD)

  • Configure the server to support ARD.

  • Go to Servers->Server Types->WebSphere Application Servers->yourServer->Web Container Settings->Web Container-> Asynchronous Request Dispatching.

  • Click check box for Allow Asynchronous Request Dispatcher.

  • Click OK and save.



Code up your asynchronous include:
((IBMServletContext)getServletContext().getContext("/YourContext")).getAsyncRequestDispatcher("/YourServlet").include(request,response);

You can also retrieve an include and insert it later in the page as such:
AsyncRequestDispatcher dispatcher1 = ((IBMServletContext)getServletContext().getContext("/YourContext")).getAsyncRequestDispatcher("/YourServlet");
FragmentResponse response1 = dispatcher1.getFragmentResponse(request,response);
...
response1.insertFragmentBlocking(request,response);


  • Install your ear as detailed below:

  • Select server side or client side under "Asynchronous Request Dispatch Type" in Step 1 of the app install panels
    Server side will aggregate the includes in memory.
    Client side will aggregate on client side using javascript.
    I suggest using client side so you can verify its working more easily.
    To verify, just hit your servlet and click on the page and view source and you should see the javascript added to retrieve the include.



You can contact me on linkedin for more information.